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

flashMapManager and themeResolver beans can no longer be configured without enabling bean overriding #24207

Closed
ebussieres opened this issue Nov 19, 2020 · 5 comments
Assignees
Milestone

Comments

@ebussieres
Copy link

@ebussieres ebussieres commented Nov 19, 2020

I have an application where I have my own flashMapManager implementation. In version 2.3.6, eveything works fine. I have a bean named "flashMapManager" and DispatcherServlet uses my implementation.

I tried to upgrade to version 2.4.0 and I got an error telling me that the bean in WebMvcAutoConfiguration$EnableWebMvcConfiguration cannot be registered because a bean has already been defined with that name.

I tried to enable bean overriding but the flashMapManager that is used is the SessionFlashMapManager.

How can i provide my own flashMap implementation in spring boot 2.4.x ?

I provided a simple test case here to demonstrate it
https://github.com/ebussieres/spring-boot-flashmap-bug

@wilkinsona
Copy link
Member

@wilkinsona wilkinsona commented Nov 19, 2020

Thanks very much for the sample. This is another unwanted side-effect of these changes in Spring Framework.

@sdeleuze @rstoyanchev I think we can improve the situation in Boot by overriding the flashMapManager method and making it @ConditionalOnMissingBean (as we did for the locale resolver) but I'm wondering if some Framework changes may be needed as well for non-Boot users. spring-projects/spring-framework#25290 may have taken care of things for all of the dispatcher servlet's strategy beans but just wanted to double-check.

@wilkinsona
Copy link
Member

@wilkinsona wilkinsona commented Nov 19, 2020

If they aren't already, we should also make the RequestToViewNameTranslator and ThemeResolver beans @ConditionalOnMissingBean.

@sdeleuze
Copy link
Contributor

@sdeleuze sdeleuze commented Nov 19, 2020

@wilkinsona On Framework side I think we are fine, the 4 additional beans are covered by the XML application context fine tuning that Juergen did, and on Javaconfig side we manage the 4 beans consistently.

So +1 for the changes you proposed on Boot side for the 3 other types.

@rstoyanchev
Copy link
Contributor

@rstoyanchev rstoyanchev commented Nov 19, 2020

I would only suggest that RequestToViewNameTranslator could be left out of this for now. I suspect it may not be common to use in a Boot application nor customize.

@wilkinsona
Copy link
Member

@wilkinsona wilkinsona commented Nov 19, 2020

Thanks, both. I'll go with ThemeResolver and FlashMapManager for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
6 participants