spring异常not eligible for getting processed by all BeanPostProcessors
文章目录
【注意】最后更新于 December 27, 2022,文中内容可能已过时,请谨慎使用。
起因
在使用AspectJ的时候发现注入不成功,查看控制台发现报了一连串warn not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
排查
这个log是在 org.springframework.context.support.PostProcessorRegistrationDelegate.BeanPostProcessorChecker#postProcessAfterInitialization
方法处提示的,主要问题就是 这个bean不是BeanPostProcessor类型,获取这个类名称也可以看到这个类没有被spring代理,所以无法被增强

debug查看第一个提示该异常的bean的调用栈,查看到最开始的调用入口
解决
使用lazy注解,延迟加载
总结
提前初始化常见场景
- shiro里
- ApplicationListener里
解决:is not eligible for getting processed by all BeanPostProcessors_拾年一剑的博客-CSDN博客 Shiro–解决is not eligible for getting processed by all BeanPostProcessors_IT利刃出鞘的博客-CSDN博客_is not eligible
文章作者 lialzm
上次更新 2022-12-27