use of CGLib-based proxies by setting proxyTargetClass=true on @EnableAsync and/or @EnableCaching

简介: use of CGLib-based proxies by setting proxyTargetClass=true on @EnableAsync and/or @EnableCaching

今天在做异步的时候,报了个错,错误信息如下:

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2022-08-25 17:58:30.784 [main] ERROR o.s.b.diagnostics.LoggingFailureAnalysisReporter:40 -


APPLICATION FAILED TO START


Description:

The bean 'subscribeHandler' could not be injected because it is a JDK dynamic proxy

The bean is of type 'com.sun.proxy.$Proxy195' and implements:

me.chanjar.weixin.mp.api.WxMpMessageHandler
org.springframework.aop.SpringProxy
org.springframework.aop.framework.Advised
org.springframework.core.DecoratingProxy

Expected a bean of type 'org.jeecg.modules.wechat.handler.SubscribeHandler' which implements:

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.

2022-08-25 17:58:31.721 [Thread-7] WARN com.alibaba.nacos.common.http.HttpClientBeanHolder:108 - [HttpClientBeanHolder] Start destroying common HttpClient

解决方法

启动器不能只写个@EnableAsync就完事儿了。
还需要在后面加上:(proxyTargetClass = true)
完成写法应该是这样的:

@EnableAsync(proxyTargetClass = true)

在这里插入图片描述

目录
相关文章
|
Java 数据库 Spring
【异常】because it is a JDK dynamic proxy that implements
【异常】because it is a JDK dynamic proxy that implements
539 0
IDEA第一次上传项目到gitlab
IDEA第一次上传项目到gitlab步骤
1635 1
|
XML 存储 网络协议
kettle开发篇-Http client
kettle开发篇-Http client
1345 0
|
敏捷开发 Dubbo Java
需求开发人日评估
随着敏捷开发在国内的风靡,越来越多的团队开始推行敏捷开发,这其中有一个关键事项就是:工时的人日评估。简单来说就是:项目经理会让开发人员自己评估自己负责的模块大概需要的开发周期。 人日,即按照1人几天完成,如1/人日:表示这个需求需要1个人1天完成,如果有2个人一起做,可能就是0.5天(需求开发一般1+1 < 2,因为有代码合并的兼容性要处理)。
1469 1
|
Linux 数据安全/隐私保护 Windows
更换(Pypi)pip源到国内镜像
pip国内的一些镜像 阿里云 http://mirrors.aliyun.com/pypi/simple/ 中国科技大学 https://pypi.mirrors.
247807 2
|
Java 数据库连接 mybatis
成功解决: Invalid bound statement (not found) 在已经使用mybatis的项目里引入mybatis-plus,结果不能共存的解决
这篇文章讨论了在已使用MyBatis的项目中引入MyBatis-Plus后出现的"Invalid bound statement (not found)"错误,并提供了解决方法,主要是通过修改yml配置文件来解决MyBatis和MyBatis-Plus共存时的冲突问题。
成功解决: Invalid bound statement (not found) 在已经使用mybatis的项目里引入mybatis-plus,结果不能共存的解决
spring-boot报错循环注入报错:has been injected into other beans
spring-boot报错循环注入报错:has been injected into other beans
1753 3
|
负载均衡 Java 数据库连接
SpringCloud之OpenFeign简单使用
当远程服务调用失败时,会采用熔断降级策略,调用熔断降级的方法返回。
457 2
|
NoSQL Java Redis
Redis 从入门到精通之Redis操作删除指定Key
删除redis 可以使用Del、unlinke。推荐使用unlink。Redis是一个内存数据库,删除key会立即释放内存,因此要慎重删除,避免误删重要数据。
7148 109
|
机器学习/深度学习 自然语言处理 API
初识LangChain的快速入门指南
初识LangChain的快速入门指南