在Heroku上运行Spring Boot App时的循环依赖

时间:2019-04-24 09:56:29

标签: java spring spring-boot heroku

我有一个spring boot应用程序,该应用程序在本地计算机上启动时没有任何问题。但是,当我在Heroku环境中运行此应用程序时,我的日志中就会出现此错误:

Description:

The dependencies of some of the beans in the application context form a cycle:

userController defined in URL [jar:file:/app/target/api-0.0.1-SNAPSHOT.jar!/BOOT-INF/classes!/*/UserController.class]
┌─────┐
|  userFacade defined in URL [jar:file:/app/target/api-0.0.1-SNAPSHOT.jar!/BOOT-INF/classes!/*/domain/UserFacade.class]
↑     ↓
|  OAuth2AuthorizationServerConfig (field private org.springframework.security.authentication.AuthenticationManager *.OAuth2AuthorizationServerConfig.authenticationManager)
↑     ↓
|  webSecurityConfig (field private *.UserFacade *.WebSecurityConfig.userFacade)
└─────┘

当我使用MavenRunner(MVN springboot:run)时,该应用程序启动也没有任何问题。并且根据Heroku文档,在我的本地环境中,我具有完全相同的Java版本。

Spring引导版本:2.1.4.RELEASE Java版本:11.0.3。

此错误的原因是什么?

编辑: 我知道添加@Lazy可以解决问题,但是我很感兴趣为什么在某些机器上我的代码可以工作,而在另一台机器上却不能。另外,为什么从maven运行该应用程序不会引起问题。

0 个答案:

没有答案
相关问题