Rossen Stoyanchev opened SPR-8350 and commented
The ContentNegotiatingViewResolver supports a property with nested ViewResolvers. When using Java-based configuration this property is likely to be populated with ViewResolvers created in the same method and not by an ApplicationContext. Some ViewResolvers however implement ApplicationContextAware and depend on access to an ApplicationContext (e.g. UrlBasedViewResolver and sub-classes).
Of course it is possible to create the nested ViewResolvers from separate @Bean
methods but that's not ideal and seems to defeat the purpose of having nested ViewResolvers in the first place. Instead the ContentNegotiatingViewResolver can check if the provided ViewResolvers are registered in the container and if not initialize them through the BeanFactory.
Affects: 3.0.5