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
Suggested WebSocket config causes circular bean reference #27746
Comments
Does the second one actually work? That method wouldn't be called by anything, so while it might appear to solve it it would/could break things. What I think is weird is the while circular dependency in the first place, as there is none. As you are using Spring Boot it might be that parts of that configuration kicks in. Finally you might be better of using constructor injection in your |
This is what I was wondering about as well. This is the reason my application(s) fail to start:
So either something important is missing here or I'm not understanding it correctly. By the way, you are right about the second one. I should definitely forward this to my colleagues suggesting me this solution. Thanks for that. |
Running it with |
The documentation tries to make use of the |
After debugging into the code a little bit deeper there is nothing that proves @rstoyanchev point otherwise. Running in debug additionally did not help much further, it just validates the explanation once again: Stacktrace
Thanks for updating the documentation @rstoyanchev. Even though, as @mdeinum already mentioned, this may not be the best solution. The |
Oops, did not want to close it. |
Affects: Spring Boot > 2.6.0, Spring Framework 5.3.10
Hello everyone,
right before the weekend I updated our microservices to Spring Boot 2.6.0. Some of them using websockets for real-time synchronization with the UI. A while ago we set them up using the suggested configuration as seen in:
https://github.com/spring-projects/spring-framework/blob/main/src/docs/asciidoc/web/websocket.adoc#simple-broker
Now, without any changes to our code, our websocket configuration contains a circular dependency which can be fully removed when removing the
TaskScheduler
, which of course isn't the solution, but helps to determine the circular dependency. In my opinion the suggested configuration should not contain a circular dependency when it is not recommended to use them.One should probably update the documentation to fix this issue.
So far I have found two ways to fix this problem. First being a lazy initialization of the
TaskScheduler
bean:This does not work. The second one is overloading the method `configureMessageBroker`:
Should the documentation be updated or are there any downsides of using the suggested solutions?
The text was updated successfully, but these errors were encountered: