-
Notifications
You must be signed in to change notification settings - Fork 41.2k
Difficult to reason about application context type in SpringApplication #14814
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
In the case of a test it is not that simple. There are actually more flavours of this as indicated by the
The real problem IMO is that we still have a few places where the logic is handled manually rather than derive from something that was set upstream. I wonder now if changing that |
I think that |
I want to work on this issue |
@andresetevejob thanks for the offer but with RSocket support this will have to be revisited one way or the other (ping @bclozel). I've added |
I've closed #16412 as we don't need to do that anymore. The REACTIVE type might not be strictly necessary, so we still need to make up our mind about it - this time with the fact that it seems that RSocket apps don't really need their own application type to work. |
We're cleaning out the issue tracker and closing issues that we've not seen much demand to fix. Feel free to comment with additional justifications if you feel that this one should not have been closed. |
I wanted to write a listener that ensured the application context type in a
SpringApplication
was not annotation-driven (the default setting). It almost works to simply inspect thewebApplicationType
(which has a public accessor) because the default application context type is strongly correlated with that, but not quite. It doesn't work in tests that expect a mock server (the default) because the test context loader sets thewebApplicationType
toREACTIVE
(until recently it wasNONE
by accident), and then you have to guess that the user wants to run a real server and get it wrong (the server fails to start, but it's not supposed to even be created in the test).We could fix this (for me) by simply providing a public accessor for the
applicationContextType
inSpringApplication
. I have worked around it using reflection to access that field. I'm open to other ideas.My listener currently, for reference, in case it helps:
The text was updated successfully, but these errors were encountered: