没有在service实现类的方法上加@Cacheable注解之前一直没有报错,加了之后就报如下错误,最后找到原因是在其他类里注入了这个加了注解的实现类,改成注入该实现类实现的接口类之后就不报错了。
报错:
2019-08-01 09:20:48.631 [ERROR] o.s.b.d.LoggingFailureAnalysisReporter -
***************************
APPLICATION FAILED TO START
***************************
Description:
The bean 'honeypotServiceImpl' could not be injected as a 'com.yufeng.honeypot.service.impl.HoneypotServiceImpl' because it is a JDK dynamic proxy that implements:
com.yufeng.honeypot.service.HoneypotService
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.
修改前: