Correct check for ViewResolver beans
Check for bean names of type rather than actual beans. Issue: SPR-12267
This commit is contained in:
parent
7bc8e5199e
commit
803fc20019
|
|
@ -801,9 +801,9 @@ public class WebMvcConfigurationSupport implements ApplicationContextAware, Serv
|
||||||
configureViewResolvers(registry);
|
configureViewResolvers(registry);
|
||||||
|
|
||||||
if (registry.getViewResolvers().isEmpty()) {
|
if (registry.getViewResolvers().isEmpty()) {
|
||||||
Map<String, ViewResolver> map = BeanFactoryUtils.beansOfTypeIncludingAncestors(
|
String[] names = BeanFactoryUtils.beanNamesForTypeIncludingAncestors(
|
||||||
this.applicationContext, ViewResolver.class, true, false);
|
this.applicationContext, ViewResolver.class, true, false);
|
||||||
if (map.isEmpty()) {
|
if (names.length == 1) {
|
||||||
registry.getViewResolvers().add(new InternalResourceViewResolver());
|
registry.getViewResolvers().add(new InternalResourceViewResolver());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue