You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After upgrading to 4.1.0 I noticed that jsp views were no longer resolving. The app wasn't explicitly creating any view resolvers so I assumed some default resolvers had changed. I went a digging a bit and found the below.
The DispatcherServlet registers, if no viewResolvers have been registered, default view resolvers in initViewResolvers. This causes leads to an InternalResourceViewResolver being registered. Before upgrading to 4.1 this is the resolver that was resolving my app's views.
First, the app is using @EnableWebMvc. In 4.1 WebMvcConfigurationSupport added the mvcViewResolver method which registers a composite view resolver. In my case the viewResolverRegistry contains no viewResolvers so the composite resolver has nothing to delegate to. The registered composite view resolver causes the initViewResolvers method in DispatcherServlet to skip registration of the default view resolvers. My app ends up with no useful viewResolvers registered (just the composite with no delegates).
The issue is easy to work around (register a viewResolver), but it seems non-intuitive that enabling WebMvc support would cause this.
Let me know if there are any more details I can provide or if there are suggestions on how to better configure things.
Actually this is what we had initially before an issue surfaced where another ViewResolver with default order (lowest precedence) may be "shadowed", see #16629. Seems like we need to refine the approach and check if other ViewResolver beans exist. That was we can preserve the DispatcherServlet default behavior when no ViewResolver declarations are made.
kyle leonhard opened SPR-12267 and commented
After upgrading to 4.1.0 I noticed that jsp views were no longer resolving. The app wasn't explicitly creating any view resolvers so I assumed some default resolvers had changed. I went a digging a bit and found the below.
The DispatcherServlet registers, if no viewResolvers have been registered, default view resolvers in initViewResolvers. This causes leads to an InternalResourceViewResolver being registered. Before upgrading to 4.1 this is the resolver that was resolving my app's views.
First, the app is using
@EnableWebMvc
. In 4.1 WebMvcConfigurationSupport added the mvcViewResolver method which registers a composite view resolver. In my case the viewResolverRegistry contains no viewResolvers so the composite resolver has nothing to delegate to. The registered composite view resolver causes the initViewResolvers method in DispatcherServlet to skip registration of the default view resolvers. My app ends up with no useful viewResolvers registered (just the composite with no delegates).The issue is easy to work around (register a viewResolver), but it seems non-intuitive that enabling WebMvc support would cause this.
Let me know if there are any more details I can provide or if there are suggestions on how to better configure things.
Affects: 4.1 GA
Issue Links:
Referenced from: commits 803fc20, 49cf30e
The text was updated successfully, but these errors were encountered: