SpringBoot 开启AOP后 出现无法注入的问题 真是坑的很啊
提示错误
org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type
或者
java.lang.ClassCastException: com.sun.proxy.$Proxy12 cannot be cast to cn.edu.nuc.SpringTest.service.impl.DemoServiceImpl
解决办法:
在application.properties中添加配置
#true为使用CGLIB代理,false为JDK代理,默认为false
spring.aop.proxy-target-class=true
引以为戒啊!!!!!!!