在SSH框架中方法,我们一般都会把方法配置成支持事物。
但有时,由于业务需要,有些方法要配置成不支持事物。
<bean id="datasource" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName">
<value>java:comp/env/jdbc/xxxxxxDS</value>
</property>
</bean>
<bean id="transactionManager"
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource">
<ref local="datasource" />
</property>
</bean>
<bean id="transactionInterceptor"
class="org.springframework.transaction.interceptor.TransactionInterceptor">
<property name="transactionManager">
<ref bean="transactionManager" />
</property>
<property name="transactionAttributes">
<props>
<prop key="*">PROPAGATION_REQUIRED,-Exception</prop>
<prop key="saveGoodsImage">PROPAGATION_NOT_SUPPORTED</prop>
<prop key="createTblInterfaceHis">PROPAGATION_REQUIRES_NEW</prop>
</props>
</property>
</bean>