且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

BeanNameAutoProxyCreator setBeanNames正则表达式不起作用?

更新时间:2022-03-03 23:26:46

您必须设置

beanNameAutoProxyCreator.setProxyTargetClass(true);

,以便Spring使用CGLIB代理您的实例.否则,它将使用仅支持接口的JDK代理.

so that Spring uses CGLIB to proxy your instances. Otherwise, it uses JDK proxies which only support interfaces.

请注意,您当前正在(不知不觉中)代理可能由Web MVC配置注册的bean.这些不一定支持代理(例如final类).

Note that you're currently proxying (knowingly or unknowingly) beans that may be registered by your Web MVC configuration. These might not necessarily support proxying (final classes for example).