Skip to content
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

Provide access to ApplicationContext via ServerWebExchange [SPR-16298] #20845

spring-issuemaster opened this issue Dec 13, 2017 · 2 comments


None yet
2 participants
Copy link

commented Dec 13, 2017

Madhura Bhave opened SPR-16298 and commented

In the MVC world, we can get the servletContext from the HttpServletRequest and then get a handle on the ApplicationContext.

It would be nice if we could have something similar for a ServerWebExchange.

Issue Links:

  • #21510 The WebHttpHandlerBuilder copy constructor does not copy the applicationcontext

Referenced from: commits 37f0e8c

0 votes, 5 watchers


This comment has been minimized.

Copy link
Collaborator Author

commented Jan 5, 2018

Rossen Stoyanchev commented

This can be done although the ApplicationContext may or may not be available. When WebHttpHandlerBuilder#applicationContext is used to bootstrap by detecting WebHandler's, WebFilter's, and others in the context (this is the common case) it would be available. WebHttpHandlerBuilder can also be used to directly register request handling components and that is less likely but possible still. So such a method would have to be @Nullable.

Can you share a little more about your use case? We haven't run into this yet since many components that need access to the ApplicationContext (like handler mappings, view resolvers) are beans themselves and can be injected with it.


This comment has been minimized.

Copy link
Collaborator Author

commented Jan 5, 2018

Stéphane Nicoll commented

Thanks for the reply. Here is the related issue. We have dedicated RequestMatchers for securing the actuator and the implementation gets the actual information that it needs when the path needs to be resolved. It's working fine in MVC but we can't implement the same thing in WebFlux because of this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.