admin管理员组

文章数量:1534214

Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'orderEvaluateStatisticsServiceImpl': Unsatisfied dependency expressed through field 'orderInfoService'; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'orderInfoServiceImpl': Bean with name 'orderInfoServiceImpl' has been injected into other beans [messageLogServiceImpl,callRecordServiceImpl,shopInfoServiceImpl] 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.

但是我在本地运行并没有出现问题、只是服务器部署出现。

has been injected into other beans  从字面上意义可以了解出,存在多版本的不同实例(topicService)

具体原因不知

解决方案

在注入@Autowired 下加@Lazy 注解即可(两边都加比较保险) 

 当然, 最好的解决办法是进行解耦。

 

       但,如果改动比较大,可以在你的配置文件中,在互相依赖的两个bean的任意一个加上lazy-init属性

       或者在你注意bean 的时候,在互相依赖的两个bean上加上@Lazy注解也可以。

 

@Autowired @Lazy 
private ClassA classA; 
@Autowired @Lazy 
private ClassB classB;

本文标签: VersionRAWPartreferencecircular