-
Notifications
You must be signed in to change notification settings - Fork 167
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
Allow simpler extension of the SpringServlet / structuring of SpringBootAutoConfiguration #19994
Comments
A simpler approach to this would be to implement AbstractView which will be extended by Route classes and implement access delegate method there which also takes care of handling thread locals before and after ui.access(..).
|
We can't do something like you suggested above, as the The data that we need available at the point that However, the hook to do what we want to do is there, and documented in the Javadocs - so I don't understand the reluctance to make the facility easier to use. If we're not expected to use it, could I suggest that it be deprecated or the documentation updated to reflect this?
|
Hi, is there any update on this? Thanks |
Hi! Sorry for slow response, we have been quite busy with 24.5 beta/RC phase. Will resume on this first thing Monday. |
This proved to be difficult to implement due to Spring issues and also not able to break backwards compatibility. I added a static method for default configuration of the SpringServlet (or whatever is extending SpringServlet) here: #20276 This means that with this PR, providing a custom servlet with default configuration would look for example something like this:
Please let me know if this solution is usable enough for you. If not, we'll keep exploring possible other options. |
@pgould-taskize @jameskerrtaskize If you have any thoughts on the PR and example above, please comment here. Thank you! |
That looks good to me, means that we don't have to essentially copy boiler plate code into our configuration. Thanks! |
Fixes #19994 Co-authored-by: Teppo Kurki <[email protected]>
Fixes #19994 Co-authored-by: Teppo Kurki <[email protected]>
This ticket/PR has been released with Vaadin 24.5.1. |
This ticket/PR has been released with Vaadin 24.6.0.alpha2 and is also targeting the upcoming stable 24.6.0 version. |
This ticket/PR has been released with Vaadin 24.4.15. |
Describe your motivation
We have certain ThreadLocal values that need to be set before access tasks are run.
The
com.vaadin.flow.server.VaadinService
provides a hook to allow overriding theaccessSession
, and in order to do this, one needs to extend theVaadinServlet
class and override thecreateServletService()
, which used to be advertised as ahttps://vaadin.com/docs/v14/flow/advanced/tutorial-application-lifecycle.
This documentation has been removed in the V24 documentation, yet no other strategy for achieving the same process has been given, although it seems that this is still possible but requires requires cut pasting of the
com.vaadin.flow.spring.SpringBootAutoConfiguration#servletRegistrationBean
.Describe the solution you'd like
Could the auto-configuration be modified in such a way that cut and pasting the entire
servletRegistrationBean
is not necessary, for example, the only piece of code that I'd like to have to supply is thespringServletBean
definition in the following configuration:Describe alternatives you've considered
Any other hooks to execute code prior to access tasks being run and cleaned up afterwards would be perfectly acceptable.
Additional context
Is there anything else you can add about the proposal?
The text was updated successfully, but these errors were encountered: