Skip to content

Commit 803fc20

Browse files
committed
Correct check for ViewResolver beans
Check for bean names of type rather than actual beans. Issue: SPR-12267
1 parent 7bc8e51 commit 803fc20

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/WebMvcConfigurationSupport.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -801,9 +801,9 @@ public ViewResolver mvcViewResolver() {
801801
configureViewResolvers(registry);
802802

803803
if (registry.getViewResolvers().isEmpty()) {
804-
Map<String, ViewResolver> map = BeanFactoryUtils.beansOfTypeIncludingAncestors(
804+
String[] names = BeanFactoryUtils.beanNamesForTypeIncludingAncestors(
805805
this.applicationContext, ViewResolver.class, true, false);
806-
if (map.isEmpty()) {
806+
if (names.length == 1) {
807807
registry.getViewResolvers().add(new InternalResourceViewResolver());
808808
}
809809
}

0 commit comments

Comments
 (0)