从Spring AOP浅析声明式事务
Spring AOP(Aspect Oriented Programming)
<!--数据源配置--><bean id="dataSources_order" destroy-method="close"><property name="driverClassName" value="oracle.jdbc.driver.OracleDriver"></property><property name="url" value="jdbc:oracle:thin:@127.0.0.1:1526:db"></property><property name="username" value="test"></property><property name="password" value="123123"></property><property name="minIdle" value="2"></property><property name="maxIdle" value="50"></property><property name="maxActive" value="90"></property></bean><!--配置事务数据源--><bean id="defaultChannelManager" ref="dataSources_order"></property></bean><!--声明一个通知--><tx:advice id="defaultChanneltxAdvice" transaction-manager="defaultChannelManager"><tx:attributes><tx:method name="batchInsertChannel" propagation="REQUIRED" rollback-for="ManagerException"/><tx:method name="updateChannelPlan" propagation="REQUIRED" rollback-for="ManagerException"/><tx:method name="deleteManagerItem" propagation="REQUIRED" rollback-for="ManagerException"/><tx:method name="*" read-only="true"/></tx:attributes></tx:advice><aop:config><!--切入点,声明需要拦截的对象--><aop:pointcut expression="execution(* com.xiu.trademanager.biz.core.channel.impl.DefaultChannelManager.*(..))" id="defaultChannelManagerMethod"/><aop:advisor advice-ref="defaultChanneltxAdvice" pointcut-ref="defaultChannelManagerMethod"/></aop:config>?