APPLICATION FAILED TO START
Description:
The dependencies of some of the beans in the application context form a cycle:
┌─────┐
| dataSource defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]
↑ ↓
| org.springframework.boot.autoconfigure.jdbc.DataSourceInitializerInvoker
└─────┘
Action:
Relying upon circular references is discouraged and they are prohibited by default. Update your application to remove the dependency cycle between beans. As a last resort, it may be possible to break the cycle automatically by setting spring.main.allow-circular-references to true.
Process finished with exit code 1
解决方案:
在application.properties添加一行配置,spring循环依赖
spring.main.allow-circular-references=true
本文介绍了一种常见的Spring框架中应用程序启动失败的情况,即由于应用上下文中某些Bean存在循环依赖而导致的问题。文章提供了具体的错误信息及如何通过配置允许循环依赖来解决此问题的方法。
3487

被折叠的 条评论
为什么被折叠?



