这篇博客记录了在使用Spring时遇到的'but was actually of type 'com.sun.proxy.$Proxy62''错误的解决过程。通过堆栈信息分析,提出两种解决方案:一是注解方式,添加@EnableAspectJAutoProxy并设置proxyTargetClass属性;二是配置文件方式,调整代理相关配置。同时,博主还分享了@EnableAspectJAutoProxy注解的源码理解,帮助读者深入掌握问题本质。
摘要由CSDN通过智能技术生成
堆栈信息
2020-01-15T16:42:18.935+08:00 WARN xxxxxx
Caused by: org.springframework.beans.factory.BeanNotOfRequiredTypeException: xxxxx but was actually of type 'com.sun.proxy.$Proxy62'
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1257)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1167)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:593)
... 53 common frames omitted