TransactionProxyFactoryBeanおよびabstractプロパティを使用して構成をシンプル化する【宣言トランザクション構成方法】


<bean id="atomikosUserTransaction"
		class="com.atomikos.icatch.jta.UserTransactionImp" />

	<bean id="atomikosTransactionManager"
		class="com.atomikos.icatch.jta.UserTransactionManager"
		init-method="init" destroy-method="close">
		<property name="forceShutdown">
			<value>true</value>
		</property>

		<property name="transactionTimeout">
			<value>30000</value>
		</property>
	</bean>
<bean id="transactionManager"
		class="org.springframework.transaction.jta.JtaTransactionManager">
		<property name="transactionManager">
			<ref bean="atomikosTransactionManager" />
		</property>
		<property name="userTransaction">
			<ref bean="atomikosUserTransaction" />
		</property>
	</bean>
× このような も、 も く されている トランザクション です.×
<!--           -->
<bean id="baseTransactionProxy" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"
        abstract="true">
        <property name="transactionManager">
            <ref bean="transactionManager"/>
        </property>
        <property name="transactionAttributes">
            <props>
                <prop key="insert*">PROPAGATION_REQUIRED</prop>
                <prop key="update*">PROPAGATION_REQUIRED</prop>
                <prop key="save*">PROPAGATION_REQUIRED</prop>
                <prop key="find*">PROPAGATION_SUPPORTS,readOnly</prop>
                <prop key="get*">PROPAGATION_SUPPORTS,readOnly</prop>
                <prop key="*">PROPAGATION_SUPPORTS,readOnly</prop>
            </props>
        </property>
    </bean>
 
 <!—      -->
<bean id="com.prs.application.ehld.sample.biz.service.sampleService.target"
          class="com.prs.application.ehld.sample.biz.service.impl.SampleServiceImpl">
        <property name="userInfoDAO"
           ref="com.prs.application.ehld.sample.integration.dao.userInfoDAO">
         </property>
    </bean>
 
<!—             -->
<bean id="com.prs.application.ehld.sample.biz.service.sampleService" parent="baseTransactionProxy">
        <property name="target"
           ref="com.prs.application.ehld.sample.biz.service.sampleService.target">
         </property>
    </bean>
abstractプロパティを すると、プロキシオブジェクトが されたトランザクションプロパティを し、 を できます.