diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/config/ResourcesBeanDefinitionParser.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/config/ResourcesBeanDefinitionParser.java index 3ec0b059faf..5c4c8f8ca8a 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/config/ResourcesBeanDefinitionParser.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/config/ResourcesBeanDefinitionParser.java @@ -200,8 +200,8 @@ class ResourcesBeanDefinitionParser implements BeanDefinitionParser { private void parseResourceCache(ManagedList resourceResolvers, ManagedList resourceTransformers, Element element, Object source) { - Element resourceCacheElement = DomUtils.getChildElementByTagName(element, "resource-cache"); - if (resourceCacheElement != null) { + String resourceCache = element.getAttribute("resource-cache"); + if ("true".equals(resourceCache)) { ConstructorArgumentValues cavs = new ConstructorArgumentValues(); RootBeanDefinition cachingResolverDef = new RootBeanDefinition(CachingResourceResolver.class); @@ -214,8 +214,8 @@ class ResourcesBeanDefinitionParser implements BeanDefinitionParser { cachingTransformerDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE); cachingTransformerDef.setConstructorArgumentValues(cavs); - String cacheManagerName = resourceCacheElement.getAttribute("cache-manager"); - String cacheName = resourceCacheElement.getAttribute("cache-name"); + String cacheManagerName = element.getAttribute("cache-manager"); + String cacheName = element.getAttribute("cache-name"); if (StringUtils.hasText(cacheManagerName) && StringUtils.hasText(cacheName)) { RuntimeBeanReference cacheManagerRef = new RuntimeBeanReference(cacheManagerName); cavs.addIndexedArgumentValue(0, cacheManagerRef); diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/ResourceHandlerRegistration.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/ResourceHandlerRegistration.java index 2e8dcc612e6..d4ab426c4e2 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/ResourceHandlerRegistration.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/ResourceHandlerRegistration.java @@ -99,7 +99,7 @@ public class ResourceHandlerRegistration { * * @param cacheResources whether to cache the result of resource resolution; * setting this to "true" is recommended for production (and "false" for - * development, especially when applying a version strategy. + * development, especially when applying a version strategy). * @return the same {@link ResourceHandlerRegistration} instance for chained method invocation * @since 4.1 */ diff --git a/spring-webmvc/src/main/resources/org/springframework/web/servlet/config/spring-mvc-4.1.xsd b/spring-webmvc/src/main/resources/org/springframework/web/servlet/config/spring-mvc-4.1.xsd index 0efe262195b..987d0f954b8 100644 --- a/spring-webmvc/src/main/resources/org/springframework/web/servlet/config/spring-mvc-4.1.xsd +++ b/spring-webmvc/src/main/resources/org/springframework/web/servlet/config/spring-mvc-4.1.xsd @@ -338,18 +338,6 @@ - - - - - - - - - + + + diff --git a/spring-webmvc/src/test/resources/org/springframework/web/servlet/config/mvc-config-resources-chain-no-auto.xml b/spring-webmvc/src/test/resources/org/springframework/web/servlet/config/mvc-config-resources-chain-no-auto.xml index 02ba0b6284e..907fdc9830c 100644 --- a/spring-webmvc/src/test/resources/org/springframework/web/servlet/config/mvc-config-resources-chain-no-auto.xml +++ b/spring-webmvc/src/test/resources/org/springframework/web/servlet/config/mvc-config-resources-chain-no-auto.xml @@ -6,7 +6,7 @@ http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd"> - + diff --git a/spring-webmvc/src/test/resources/org/springframework/web/servlet/config/mvc-config-resources-chain.xml b/spring-webmvc/src/test/resources/org/springframework/web/servlet/config/mvc-config-resources-chain.xml index 9023908ae29..42c4844437f 100644 --- a/spring-webmvc/src/test/resources/org/springframework/web/servlet/config/mvc-config-resources-chain.xml +++ b/spring-webmvc/src/test/resources/org/springframework/web/servlet/config/mvc-config-resources-chain.xml @@ -22,8 +22,7 @@ http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd"> - - +