欢迎光临散文网 会员登陆 & 注册

springboot 2.6+启动错误_循环依赖

2022-09-12 22:02 作者:佛系的工具人  | 我要投稿

解决升级 Spring Boot 2.6后,因循环引用导致启动时报错的问题

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.

原因

依赖循环引用是不鼓励的,默认情况下是禁止的。更新应用程序以删除bean之间的依赖循环。作为最后的手段,可以通过设置spring.main来自动打破循环。allow-circular-references为true。


只需要在application.properties 文件中 加入 一行代码


spring.main.allow-circular-references=true




springboot 2.6+启动错误_循环依赖的评论 (共 条)

分享到微博请遵守国家法律