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
Labels
type: regression A regression from a previous release
Milestone

Comments

@ebussieres
Copy link

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

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Nov 19, 2020
@wilkinsona
Copy link
Member

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 wilkinsona added type: regression A regression from a previous release and removed status: waiting-for-triage An issue we've not yet triaged labels Nov 19, 2020
@wilkinsona wilkinsona added this to the 2.4.x milestone Nov 19, 2020
@wilkinsona
Copy link
Member

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

@sdeleuze
Copy link
Contributor

@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 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

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
Labels
type: regression A regression from a previous release
Projects
None yet
Development

No branches or pull requests

6 participants