How to mix CGLIB and JDK proxies in Spring configuration files?

后端 未结 1 959
遇见更好的自我
遇见更好的自我 2021-02-10 13:09

This thread is related to a problem I am encountering here regarding the needs for access to protected methods of an advised class. I\'m using Spring 3.0.6, and have created a

相关标签:
1条回答
  • 2021-02-10 14:00

    Unfortunately, either all or none beans use CGLIB and if you use proxying of target class in one place, it is forced in all other places. Quoting 8.6 Proxying mechanisms of official documentation:

    Note

    Multiple <aop:config/> sections are collapsed into a single unified auto-proxy creator at runtime, which applies the strongest proxy settings that any of the <aop:config/> sections (typically from different XML bean definition files) specified. This also applies to the <tx:annotation-driven/> and <aop:aspectj-autoproxy/> elements.

    To be clear: using 'proxy-target-class="true"' on <tx:annotation-driven/>, <aop:aspectj-autoproxy/> or <aop:config/> elements will force the use of CGLIB proxies for all three of them.

    0 讨论(0)
提交回复
热议问题