天天看点

Service 循环引用(circular reference)问题解决spring service层 循环引用问题。

spring service层 循环引用问题。

​​Error creating bean with name 'smsCodeApiController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.zhenler.microcode.service.IWechatUserService com.zhenler.commonality.controller.api.SmsCodeApiController.wechatUserService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'wechatUserServiceImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.zhenler.eorder.food.service.IFoodService com.zhenler.microcode.service.impl.WechatUserServiceImpl.iFoodService; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'foodServiceImpl': Bean with name 'foodServiceImpl' has been injected into other beans [foodPackageServiceImpl] 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
@Lazy(true)
private IFoodPackageService foodPackageService;