All Downloads are FREE. Search and download functionalities are using the official Maven repository.

spring.spring-atomikos-standalone.xml Maven / Gradle / Ivy

There is a newer version: 6.0.0
Show newest version
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
  xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context"
  xmlns:sec="http://www.springframework.org/schema/security" xmlns:tx="http://www.springframework.org/schema/tx"
  xmlns:jpa="http://www.springframework.org/schema/data/jpa"
  xmlns:jdbc="http://www.springframework.org/schema/jdbc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.springframework.org/schema/beans
                      http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
                      http://www.springframework.org/schema/tx
                      http://www.springframework.org/schema/tx/spring-tx-4.0.xsd
                      http://www.springframework.org/schema/data/jpa
                      http://www.springframework.org/schema/data/jpa/spring-jpa.xsd
                      http://www.springframework.org/schema/jdbc
                      http://www.springframework.org/schema/jdbc/spring-jdbc-4.0.xsd
                      http://www.springframework.org/schema/context
                      http://www.springframework.org/schema/context/spring-context-4.0.xsd
                      http://www.springframework.org/schema/aop
                      http://www.springframework.org/schema/aop/spring-aop-4.0.xsd">

  <context:annotation-config />

  <context:component-scan base-package="com.atomikos.icatch.jta.hibernate4" />
  
  <tx:annotation-driven transaction-manager="transactionManager" mode="proxy" proxy-target-class="false" />

  <aop:aspectj-autoproxy />

  <bean id="txService" class="com.atomikos.icatch.config.UserTransactionServiceImp"
    init-method="init" destroy-method="shutdownWait">
  </bean>

  <bean id="txManager" class="com.atomikos.icatch.jta.J2eeTransactionManager" depends-on="txService" />

  <bean id="userTx" class="com.atomikos.icatch.jta.J2eeUserTransaction" depends-on="txService" />

  <bean id="transactionManager"
    class="org.springframework.transaction.jta.JtaTransactionManager">
    <property name="userTransaction" ref="userTx"></property>
    <property name="transactionManager" ref="txManager"></property>
  </bean>

  <bean id="dataSource" class="com.atomikos.jdbc.AtomikosDataSourceBean"
    destroy-method="close" init-method="init" depends-on="txService">
    <property name="uniqueResourceName" value="atomikos-standalone" />
    <property name="maxPoolSize" value="10" />
    <property name="minPoolSize" value="5" />
    <property name="testQuery" value="SELECT 1" />
    <property name="xaDataSource" ref="xaReferent" />
  </bean>

  <bean id="xaReferent" class="org.h2.jdbcx.JdbcDataSource">
    <property name="URL" value="jdbc:h2:~/test-db;MODE=PostgreSQL;MVCC=TRUE;DB_CLOSE_DELAY=-1" />
    <property name="user" value="sa" />
    <property name="password" value="" />
  </bean>

  <bean
    class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor" />

  <bean
    class="org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor" />

  <bean id="entityManagerFactory"
    class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
    <property name="jpaVendorAdapter">
      <bean
        class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
        <property name="database" value="H2" />
      </bean>
    </property>
    <property name="packagesToScan" value="com.atomikos.icatch.jta.hibernate4" />
    <property name="jtaDataSource" ref="dataSource" />
    <property name="jpaPropertyMap">
      <props>
        <prop key="hibernate.current_session_context_class">jta</prop>
        <prop key="javax.persistence.transactionType">jta</prop>
        <prop key="hibernate.transaction.jta.platform">com.atomikos.icatch.jta.hibernate4.AtomikosPlatform</prop>
        <prop key="hibernate.hbm2ddl.auto">create</prop>
        <prop key="hibernate.search.autoregister_listeners">false</prop>
      </props>
    </property>
  </bean>
  
   <jpa:repositories base-package="com.atomikos.icatch.jta.hibernate4" 
    entity-manager-factory-ref="entityManagerFactory" transaction-manager-ref="transactionManager" />
    
</beans>




© 2015 - 2024 Weber Informatics LLC | Privacy Policy