600字范文,内容丰富有趣,生活中的好帮手!
600字范文 > The bean ‘xxImpl‘ could not be injected as a ‘xxx‘ because it is a JDK dynamic proxy that implements

The bean ‘xxImpl‘ could not be injected as a ‘xxx‘ because it is a JDK dynamic proxy that implements

时间:2020-12-09 02:04:02

相关推荐

The bean ‘xxImpl‘ could not be injected as a ‘xxx‘ because it is a JDK dynamic proxy that implements

项目启动报错:The bean ‘xxxServiceImpl’ could not be injected as a ‘com.xxx.service.impl.xxxServiceImpl’ because it is a JDK dynamic proxy that implements:com.xxx.service.xxxService

这个错误的大概意思就是说默认采用jdk动态代理因为动态代理需要类实现接口,通过接口进行代理,但是我们通过@Autowired注解进行注入bean的时候采用了它的实现类而没有采用它的接口。

然后我就去找了项目中提示的这个类即‘xxxServiceImpl’的对象注入的地方如下:

我将这里改为service的接口:

项目就可以成功启动。

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。