81,092
社区成员
发帖
与我相关
我的任务
分享
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd">
<!-- AOP事务 -->
<tx:advice id="DomainTxAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="delete*" propagation="REQUIRED"/>
<tx:method name="remove*" propagation="REQUIRED"/>
<tx:method name="update*" propagation="REQUIRED"/>
<tx:method name="save*" propagation="REQUIRED"/>
<tx:method name="create*" propagation="REQUIRED"/>
<tx:method name="insert*" propagation="REQUIRED"/>
<tx:method name="add*" propagation="REQUIRED"/>
<tx:method name="get*" propagation="SUPPORTS" read-only="true"/>
<tx:method name="load*" propagation="SUPPORTS" read-only="true"/>
<tx:method name="query*" propagation="SUPPORTS" read-only="true"/>
<tx:method name="select*" propagation="SUPPORTS" read-only="true"/>
<tx:method name="find*" propagation="SUPPORTS" read-only="true"/>
</tx:attributes>
</tx:advice>
<aop:config proxy-target-class="true">
<aop:pointcut id="DomainServices" expression="execution(* rsj.frdc.domain..service..*.*(..))"/>
<aop:advisor pointcut-ref="DomainServices" advice-ref="DomainTxAdvice"/>
</aop:config>
</beans>
public void save(DirtyRecordFixRule rule) {
dirtyRecordFixRuleDAO.insert(rule);
throw new RuntimeException("出错了!!!");
}
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource"/>
</bean>
<bean id="oracleDataSource" class="oracle.jdbc.pool.OracleDataSource">
<property name="URL" value="${jdbc.url}"/>
<property name="user" value="${jdbc.username}"/>
<property name="password" value="${jdbc.password}"/>
<property name="connectionCachingEnabled" value="true"/>
<property name="fastConnectionFailoverEnabled" value="false"/>
<property name="connectionCacheProperties">
<props>
<prop key="InitialLimit">${jdbc.pool.initSize}</prop>
<prop key="MaxLimit">${jdbc.pool.maxSize}</prop>
<prop key="MinLimit">${jdbc.pool.oracle.MinLimit}</prop>
<prop key="InactivityTimeout">${jdbc.pool.oracle.InactivityTimeout}</prop>
</props>
</property>
<property name="connectionProperties">
<props>
<prop key="v$session.program">${SYSPROP_PROGRAM}</prop>
<prop key="v$session.terminal">${SYSPROP_TERMINAL}</prop>
</props>
</property>
</bean>