如何解决Java Spring Boot循环依赖于一种环境
我有一个Spring Boot应用程序,可以在本地,UAT和Prod环境中很好地运行,但是当我在暂存环境中部署它时,会出现以下错误:
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'Bean 1': Unsatisfied dependency expressed through field 'Class 1'; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'Bean2 of type Class1': Bean with the name 'Bean2' has been injected into other beans [Bean 3] 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.
我不确定这是否与构建过程有关。我已经检查了代码,没有循环依赖项。当我在Class3上用@Lazy
注释Bean2时,它可以很好地工作。但是我无法弄清楚为什么它可以在其他环境中使用,并且仅在登台时才需要此批注。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。