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
Comment From: wilkinsona
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. https://github.com/spring-projects/spring-framework/issues/25290 may have taken care of things for all of the dispatcher servlet's strategy beans but just wanted to double-check.
Comment From: wilkinsona
If they aren't already, we should also make the RequestToViewNameTranslator
and ThemeResolver
beans @ConditionalOnMissingBean
.
Comment From: sdeleuze
@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.
Comment From: rstoyanchev
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.
Comment From: wilkinsona
Thanks, both. I'll go with ThemeResolver
and FlashMapManager
for now.