一个循环依赖注入的问题

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'crmVoucherBlackListService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.ainemo.console.service.CrmVoucherWalletService com.ainemo.console.service.CrmVoucherBlackListService.crmVoucherWalletService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'crmVoucherWalletService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.ainemo.console.service.AsyncMethods com.ainemo.console.service.CrmVoucherWalletService.asyncMethods; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'asyncMethods': Bean with name 'asyncMethods' has been injected into other beans [enterpriseProxy] in its raw version as part of a circular reference, but has eventually been wrapped. This means that said other beans do not use the final version of the bean. This is often the result of over-eager type matching - consider using 'getBeanNamesOfType' with the 'allowEagerInit' flag turned off, for example.

今天写了一个controller,注入了CrmVoucherBlackListService,报上图错误提示

其中CrmVoucherBlackListService中又注入了CrmVoucherWalletService,

CrmVoucherWalletService其中注入有一个异步方法类AsyncMethods,

AsyncMethods中又注入了EnterpriseProxy类 来实现调用EnterpriseProxy中的方法实现业务,但EnterpriseProxy中最开始也注入了AsyncMethods来实现业务逻辑,这就出现了AsyncMethods和EnterpriseProxy之间循环依赖注入,报上面的错误

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值