Skip to content

Instantly share code, notes, and snippets.

@eugenp
Created December 25, 2011 22:03
Show Gist options
  • Save eugenp/1519810 to your computer and use it in GitHub Desktop.
Save eugenp/1519810 to your computer and use it in GitHub Desktop.
Transaction configuration with Spring 3.1 - the AOP config
<?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-3.1.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.1.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.1.xsd">
<tx:advice id="txAdvice" transaction-manager="txManager">
<tx:attributes>
<tx:method name="get*" read-only="true" />
<tx:method name="*" />
</tx:attributes>
</tx:advice>
<aop:config>
<aop:pointcut id="serviceOperation" expression="execution(* org.rest.service.*.*(..))" />
<aop:advisor advice-ref="txAdvice" pointcut-ref="serviceOperation" />
</aop:config>
</beans>
@eugenp
Copy link
Author

eugenp commented Jan 29, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment