From 803fc2001907636605aa3ed2fcdf1437171761a5 Mon Sep 17 00:00:00 2001 From: Rossen Stoyanchev Date: Mon, 29 Sep 2014 17:53:28 -0400 Subject: [PATCH] Correct check for ViewResolver beans Check for bean names of type rather than actual beans. Issue: SPR-12267 --- .../servlet/config/annotation/WebMvcConfigurationSupport.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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()); } }