spring boot

错误内容:

The bean 'RSendServiceimpl' could not be injected as a 'com.hakj.express.service.impl.RSendServiceimpl' because it is a JDK dynamic proxy that implements:
    com.hakj.express.service.OrderService


Action:

Consider injecting the bean as one of its interfaces or forcing the use of CGLib-based proxies by setting proxyTargetClass=true on @EnableAsync and/or @EnableCaching.

 

解决:

一:在@EnableAsync 或 @EnableCaching注解上加proxyTargetClass = true(本人的解决方案)

例:在启动类的EnableAsync注解上加:

@EnableAsync(proxyTargetClass = true)

 二:在application.properties中加

spring.aop.proxy-target-class=true

 

posted @ 2018-04-20 16:21  猴子1  阅读(377)  评论(0编辑  收藏  举报