diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/WebMvcConfigurationSupport.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/WebMvcConfigurationSupport.java index 648e64451a..85f29b6557 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/WebMvcConfigurationSupport.java +++ b/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 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()); } }