Spring AOP Interceptor transaction is not working
2015-09-06 11:43
549 查看
The Spring AOP transaction is not working in following interceptors?
The “
To fix it, you have to change the sequence of the interceptor xml file like following (put
Note
The sequence of Spring AOP interceptors do affect the functionality.
<bean id="testAutoProxyCreator" class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator"> <property name="interceptorNames"> <list> <idref bean="urlInterceptorInsert" /> <idref bean="urlInterceptorCommit" /> <idref bean="urlInterceptorRelease" /> <idref bean="matchGenericTxInterceptor" /> </list> </property> <property name="beanNames"> <list> <idref local="urlBo" /> </list> </property> </bean>
The “
matchGenericTxInterceptor” transaction interceptor, suppose to intercept
urlInterceptorInsert,
urlInterceptorCommit,
urlInterceptorRelease, but it’s not work as expected?
Solution
The 3 interceptors are executed before transaction manager interceptor (matchGenericTxInterceptor).
To fix it, you have to change the sequence of the interceptor xml file like following (put
matchGenericTxInterceptoron top).
<bean id="testAutoProxyCreator" class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator"> <property name="interceptorNames"> <list> <idref bean="matchGenericTxInterceptor" /> <idref bean="urlInterceptorInsert" /> <idref bean="urlInterceptorCommit" /> <idref bean="urlInterceptorRelease" /> </list> </property> <property name="beanNames"> <list> <idref local="urlBo" /> </list> </property> </bean>
Note
The sequence of Spring AOP interceptors do affect the functionality.
相关文章推荐
- Spring AOP Example – Pointcut , Advisor
- Java异常处理总结
- 深入分析 Java 中的中文编码问题
- 八成Java开发者解答不了的问题
- Spring进阶 之简介
- Java堆、栈和常量池以及相关String的详细讲解(经典中的经典)
- Eclipse环境下a class file was not written问题的解决办法
- java生成随机六位数的验证码&随机生成十位数ValidCode码,用于邮件的验证&检查是不是符合为合法的中国的手机号码
- spring 注解简单使用
- Java HashMap工作原理深入探讨
- Java Code review 一些原则的原因探讨
- 学习Java8中Lambda表达式的10个例子
- JAVA第三周抽象类的学习练习实验三
- java注解
- java SecurityManager
- JAVA第三周抽象类的学习练习实验二
- Java SE/EE/ME区别
- Spring事务管理
- JAVA第三周抽象类的学习练习实验一
- maven3常用命令、java项目搭建、web项目搭建详细图解