@Resource与@Autowired加载顺序,加载原理的区别是什么?

代码中嵌套bean的引用,我用@Resource(type=CouponServiceImpl.class)
private CouponService couponService;
或者使用
@Resource(name="couponService")
private CouponService couponService;
或者使用
@Resource
private CouponService couponService;
的时候启动报如下错:Error creating bean with name 'couponService': Bean with name 'couponService' has been injected into other beans [orderManagerServiceImpl,withdrawServiceImpl,orderServiceHelper,orderService,xmOrderServiceImpl,distributeProfitServiceImpl,distributeProfitHelper,distributeListenerImpl] 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.
用@Autowired就完全正常。 求大神帮忙解释一下,完全不懂

1个回答

songliang01
songliang01 哎,哥们辛苦了,不过我看不懂黏贴复制的
大约 4 年之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐