Fix resource-chain XML syntax for cache

This change moves the resource-cache configuration to the
<resource-chain/> tag, since enabling/disabling resource cache should
be driven by a property or a SpEL expression.

So now that configuration can be set with XML attributes:

  <mvc:resource-chain resource-cache="true"
  cache-manager="resourceCache" cache-name="test-resource-cache">

In order to mirror the JavaConfig behavior, the "resource-cache"
attribute is required.

Issue: SPR-12129
This commit is contained in:
Brian Clozel
2014-09-04 10:05:33 +02:00
parent c9c3857eae
commit 7b93cefe64
5 changed files with 15 additions and 22 deletions

View File

@@ -6,7 +6,7 @@
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd">
<mvc:resources mapping="/resources/**" location="/, classpath:/META-INF/">
<mvc:resource-chain auto-registration="false">
<mvc:resource-chain resource-cache="false" auto-registration="false">
<mvc:resolvers>
<mvc:version-resolver>
<mvc:fixed-version-strategy version="abc" patterns="/**/*.js"/>

View File

@@ -22,8 +22,7 @@
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd">
<mvc:resources mapping="/resources/**" location="/, classpath:/META-INF/">
<mvc:resource-chain>
<mvc:resource-cache cache-manager="resourceCache" cache-name="test-resource-cache"/>
<mvc:resource-chain resource-cache="true" cache-manager="resourceCache" cache-name="test-resource-cache">
<mvc:resolvers>
<mvc:version-resolver>
<mvc:fixed-version-strategy version="abc" patterns="/**/*.js"/>