-
-
Notifications
You must be signed in to change notification settings - Fork 528
Break circular references which disabled by default since spring boot 2.6 #1347
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I have this error too. I put in application.properties : |
|
worked on me too spring.main.allow-circular-references: true |
Guys, would be great if you provide a minimal reproducible sample or directly propose a PR. |
putting @lazy on the constructor is also a good option |
This ticket will be closed, as no one has provided a Minimal, Reproducible Example - with HelloController. |
Do you have customized @Component
public class DefaultWebMvcRegistrations implements WebMvcRegistrations {
@Override
public RequestMappingHandlerMapping getRequestMappingHandlerMapping() {
return new MyRequestMappingHandlerMapping();
}
} |
@bnasslahsen Here is example.zip @Override
protected void detectHandlerMethods(Object handler) {
Object handlerObject = (handler instanceof String ? obtainApplicationContext().getBean((String) handler)
: handler); // getBean will cause circular references
handlerHolder.set(handlerObject);
super.detectHandlerMethods(handler);
handlerHolder.remove();
} |
Thank you for providing a reproducible sample. |
It works now, thanks. |
I placed the spring.main.allow-circular-references: true and it worked for me too. |
The text was updated successfully, but these errors were encountered: