<?xml version= "1.0" encoding= "UTF-8"?>
<beans xmlns= "Http://www.springframework.org/schema/beans"
xmlns:context= "Http://www.springframework.org/schema/context" xmlns:p= "http://www.springframework.org/schema/p"
xmlns:aop= "HTTP://WWW.SPRINGFRAMEWORK.ORG/SCHEMA/AOP" xmlns:tx= "Http://www.springframework.org/schema/tx"
Xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance"
xsi:schemalocation= "Http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/ Spring-beans-4.0.xsd
Http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd
HTTP://WWW.SPRINGFRAMEWORK.ORG/SCHEMA/AOP http://www.springframework.org/schema/aop/spring-aop-4.0.xsd/HTTP Www.springframework.org/schema/tx
Http://www.springframework.org/schema/tx/spring-tx-4.0.xsd
Http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.0.xsd ">
<!--define transaction manager--
<bean id= "TransactionManager"
class= "Org.springframework.jdbc.datasource.DataSourceTransactionManager" >
<property name= "DataSource" ref= "DataSource"/>
</bean>
<!--define transaction policies--
<tx:advice id= "Txadvice" transaction-manager= "TransactionManager" >
<tx:attributes>
<!--all methods that start with query are read-only
<tx:method name= "query*" read-only= "true"/>
<!--other methods to use the default transaction policy--
<tx:method name= "*"/>
</tx:attributes>
</tx:advice>
<aop:config>
<!--pointcut element defines a pointcut in which the first asterisk in the execution matches the return type of the method.
Here the asterisk indicates that all return types are matched. Com.simple.sso.service.*.* (..) Indicates that all of the classes that match the Com.simple.sso.service package
Method-
<aop:pointcut id= "mypointcut" expression= "Execution (* com.simple.sso.service.*.* (..))"/>
<!--apply a defined transaction-handling policy to the above pointcut--
<aop:advisor advice-ref= "Txadvice" pointcut-ref= "Mypointcut"/>
</aop:config>
</beans>
Configuration series: (Things Management) simple configuration of Applicationcontext-transaction.xml in SSM