您好, 欢迎来到 !    登录 | 注册 | | 设为首页 | 收藏本站

在Spring的@Controller方法上使用@Before方面不起作用

在Spring的@Controller方法上使用@Before方面不起作用

肖恩·帕特里克·弗洛伊德(Sean Patrick Floyd)是对的。还有另一种方法:从Spring Proxy AOP切换到CGILib。

从Spring参考:

在那些需要建议在接口上未声明的方法或需要将代理对象作为具体类型传递给方法的情况下(在极少数情况下),可以强制使用cglib

http://static.springsource.org/spring/docs/3.0.x/reference/aop.html#aop- autoproxy-force- cglib

要强制使用cglib代理,请将<aop:config> 元素的proxy-target-class属性的值设置为true:<aop:config proxy-target-class="true">

要在使用@AspectJ自动代理支持时强制cglib代理,请将<aop:aspectj-autoproxy>元素的’proxy-target- class’属性设置为true:<aop:aspectj-autoproxy proxy-target-class="true"/>

顺便说一句:我建议改用AspectJ或Spring Proxy CGILib AOP。 /

Java 2022/1/1 18:24:16 有638人围观

撰写回答


你尚未登录,登录后可以

和开发者交流问题的细节

关注并接收问题和回答的更新提醒

参与内容的编辑和改进,让解决方法与时俱进

请先登录

推荐问题


联系我
置顶