spring事务管理(声明式 xmlschmea)
配置文件如下:引入了tx的命名空间。
<?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: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/aophttp://www.springframework.org/schema/aop/spring-aop-2.5.xsdhttp://www.springframework.org/schema/txhttp://www.springframework.org/schema/tx/spring-tx-2.5.xsd"><!--<bean id="ds"/></property></bean><bean id="tranmanager"ref="ds"></property></bean><tx:advice id="txadvice" transaction-manager="tranmanager"><tx:attributes><tx:method name="insert*" propagation="REQUIRED" /><tx:method name="find" read-only="true" /></tx:attributes></tx:advice><aop:config><aop:pointcut id="txpointcut"expression="execution(public * cn.com.gan.spring.database.IUserDao.*(..))" /><aop:advisor pointcut-ref="txpointcut" advice-ref="txadvice" /></aop:config><!--<bean id="interceptor"ref="tranmanager"></property><property name="transactionAttributeSource"value="cn.com.gan.spring.database.IUserDao.insert=PROPAGATION_REQUIRED"></property> </bean> <bean id="userdaoproxy"ref="userdao"></property> <propertyname="transactionAttributes"> <props> <propkey="insert">PROPAGATION_REQUIRED</prop> </props> </property><property name="interceptorNames"> <list> <value>interceptor</value></list> </property> </bean>--></beans>