使用弹簧:
jta-transaction-manager 可以使用 id 作为名称,以便我可以将其作为 REF 传递给我的服务层,如下所示?
tx:jta-transaction-manager 只能用于 je22 容器吗?我的意思是Tomcat,我需要手动完成,如下所示:
<tx:jta-transaction-manager id="name_transactionmanager"/> <bean id="projectService" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"> <property name="transactionManager" ref="name_transactionmanager"/> <property name="target"> <bean class="com.company.project.company.services.ServiceImpl" init-method="init"> <property name="HRappsdao" ref="HRappsdao"/> <property name="projectdao" ref="projectdao"/> </bean> </property> <property name="transactionAttributes"> <props> <prop key="store*">PROPAGATION_REQUIRED</prop> <prop key="update*">PROPAGATION_REQUIRED</prop> <prop key="remove*">PROPAGATION_REQUIRED</prop> <prop key="bulkUpdate*">PROPAGATION_REQUIRED</prop> <prop key="*">PROPAGATION_SUPPORTS,readOnly</prop> </props> </property> </bean>
对于问题 2
<bean id="transactionManager"
class="org.springframework.transaction.jta.JtaTransactionManager">
<property name="userTransaction">
<bean class="org.springframework.transaction.jta.JotmFactoryBean"/>
</property>
</bean>