-
Notifications
You must be signed in to change notification settings - Fork 38.3k
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
Align DispatcherServlet defaults for Java and XML #25209
Comments
I have a branch that includes these additional beans in both Java and XML configuration. I can provide a pull request if you like? I was still pondering on the lazy loading. This kind of mechanism is used on other places as well, would it make sense to extract to loading of default strategies to a standalone class, for reuse in other places as well? |
After a deeper look I think there is a 4th bean to add: |
Prior to this commit some of the default strategies defined for the DispatcherServlet weren't included in the default configuration for both Java and XML configuration. The following default beans have been added to the configuration with the name as expected by the DispatcherServlet: . org.springframework.web.servlet.i18n.AcceptHeaderLocaleResolver . org.springframework.web.servlet.theme.FixedThemeResolver . org.springframework.web.servlet.support.SessionFlashMapManager . org.springframework.web.servlet.view.DefaultRequestToViewNameTranslator Fixes: spring-projectsgh-25209
Pull request added. I considered adding a test to check if all the defaults have been added (1 for XML and 1 for Java), not sure if that would make sense or be helpful? |
I think this is ok as provided in your PR, thanks. |
With spring-projects#25209, DispatcherServlet.properties loading and parsing will be useless for most of use cases, and it requires configuration on GraalVM native images. The purpose of this issue to make such loading and parsing lazy, only invoked in getDefaultStrategies() if needed. Closes spring-projectsgh-25257
Prior to this commit some of the default strategies defined for the DispatcherServlet weren't included in the default configuration for both Java and XML configuration. The following default beans have been added to the configuration with the name as expected by the DispatcherServlet: - org.springframework.web.servlet.i18n.AcceptHeaderLocaleResolver - org.springframework.web.servlet.theme.FixedThemeResolver - org.springframework.web.servlet.support.SessionFlashMapManager - org.springframework.web.servlet.view.DefaultRequestToViewNameTranslator Closes spring-projectsgh-25209
Superseded by #25260. |
In order to improve GraalVM compatibility (by requiring less reflection configuration) and for the sake of consistency, we should probably register these 4 missing beans in
WebMvcConfigurationSupport
:org.springframework.web.servlet.i18n.AcceptHeaderLocaleResolver
org.springframework.web.servlet.theme.FixedThemeResolver
org.springframework.web.servlet.support.SessionFlashMapManager
org.springframework.web.servlet.view.DefaultRequestToViewNameTranslator
We should also make sure the same is done on XML side and should then make
DispatcherServlet.properties
parsing lazy as most use case will not use it.Finally, we should check that no Spring Boot configuration update is needed.
The text was updated successfully, but these errors were encountered: