Correct check for ViewResolver beans

Check for bean names of type rather than actual beans.

Issue: SPR-12267
master
Rossen Stoyanchev 10 years ago
parent 7bc8e5199e
commit 803fc20019
  1. 4
      spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/WebMvcConfigurationSupport.java

@ -801,9 +801,9 @@ public class WebMvcConfigurationSupport implements ApplicationContextAware, Serv
configureViewResolvers(registry);
if (registry.getViewResolvers().isEmpty()) {
Map<String, ViewResolver> map = BeanFactoryUtils.beansOfTypeIncludingAncestors(
String[] names = BeanFactoryUtils.beanNamesForTypeIncludingAncestors(
this.applicationContext, ViewResolver.class, true, false);
if (map.isEmpty()) {
if (names.length == 1) {
registry.getViewResolvers().add(new InternalResourceViewResolver());
}
}

Loading…
Cancel
Save