当前位置:网站首页>Solve the circular dependency bug. Relying upon circular references is discouraged and they are prohibited by default.

Solve the circular dependency bug. Relying upon circular references is discouraged and they are prohibited by default.

2022-06-11 13:44:00 limmmll

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.

The general reason for this error is that : Relying on circular references is discouraged , It's forbidden by default . Update your application to remove bean Dependency loops between . As a last resort , It can be done by putting spring.main.allow-circular-references Set to true To automatically interrupt the loop .

The solution is as follows :

1. If it is .properties file , Add... To the file

spring.main.allow-circular-references=true

2. If it is .yml file , Add to file

spring:
  main:
    allow-circular-references:true

Then restart the project .

原网站

版权声明
本文为[limmmll]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/162/202206111342275013.html

随机推荐