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
WebSessionIdResolverAutoConfiguration should only be active in a reactive web application #29669
Comments
Thanks for the report, @janssk1. It looks as if we could apply a fix that's similar to the fix for #21789 but I'm wondering why |
I have updated the example from the previous ticket: janssk1/spring-context-hierarchy@d4d8cff As soon as reactor-core is in the classpath (in our case, it was on the classpath for an unrelated reason), the WebSessionIdResolverAutoConfiguration kicks in and instantiates ServerProperties |
Thank you. As I'd hoped, marking |
|
We are using an ApplicationContext hierarchy in our Spring Boot application. Each child application has their own webserver using a unique port, that is configured through a custom child specific properties file. This works fine in spring boot 2.5. However, after upgrading to 2.6(.2), the single parent context contains already a ServerProperties instance, causing all child component to reuse that one instead of creating their own, breaking our configuration.
After some digging, the problem seems to be a change in WebSessionIdResolverAutoConfiguration. Since 2.6, that one requires ServerProperties, causing it to be added to the root context.
As a workaround, we have explicitly removed the WebSessionIdResolverAutoConfiguration from our root context (using EnableAutoConfiguration(exclude={WebSessionIdResolverAutoConfiguration.class})).
I see a similar issue was raised and fixed when migrating from 2.2 to 2.3 (#21789).
Our current way of providing different servers per child component relies on the assumption that the parent context does not contain an instance of ServerProperties. This seems to be a brittle assumption. Is there a better (more stable) approach to achieve what we are trying to do ?
The text was updated successfully, but these errors were encountered: