关于 Spring 循环依赖的问题

21次阅读

共计 615 个字符,预计需要花费 2 分钟才能阅读完成。

最近发现一个问题

Linux 服务器通过 maven 打出来的部分项目, 部署的时候会出现循环依赖报错
但是同样的代码,在 Windows 机器上打出来的 jar 包,部署在相同服务器上不会有循环依赖的报错
没有问题的项目中,也有部分存在循环依赖,但是也能正常部署, 只有极个别的项目有上述的问题。

springboot 版本 2.0.5
jdk 1.8

Caused by: org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name ‘applyServiceImpl’: Bean with name ‘applyServiceImpl’ has been injected into other beans [contractServiceImpl] 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

正文完
 0