Skip to content

Commit bf94344

Browse files
committed
document XML attributes in mvc:resource-chain
Issue: SPR-12804
1 parent b3f0199 commit bf94344

File tree

2 files changed

+35
-5
lines changed

2 files changed

+35
-5
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,8 @@ public ResourceChainRegistration resourceChain(boolean cacheResources) {
120120
* development, especially when applying a version strategy.
121121
* @param cache the cache to use for storing resolved and transformed resources;
122122
* by default a {@link org.springframework.cache.concurrent.ConcurrentMapCache}
123-
* is used.
123+
* is used. As Resources aren't serializable and can be dependent of the application host,
124+
* one should not use a distributed cache but rather an in-memory cache.
124125
* @return the same {@link ResourceHandlerRegistration} instance for chained method invocation
125126
* @since 4.1
126127
*/

spring-webmvc/src/main/resources/org/springframework/web/servlet/config/spring-mvc-4.1.xsd

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -471,10 +471,39 @@
471471
<xsd:element name="resolvers" type="resource-resolvers" minOccurs="0" maxOccurs="1"/>
472472
<xsd:element name="transformers" type="resource-transformers" minOccurs="0" maxOccurs="1"/>
473473
</xsd:sequence>
474-
<xsd:attribute name="resource-cache" type="xsd:boolean" use="required"/>
475-
<xsd:attribute name="auto-registration" type="xsd:boolean" default="true" use="optional"/>
476-
<xsd:attribute name="cache-manager" type="xsd:string" use="optional"/>
477-
<xsd:attribute name="cache-name" type="xsd:string" use="optional"/>
474+
<xsd:attribute name="resource-cache" type="xsd:boolean" use="required">
475+
<xsd:annotation>
476+
<xsd:documentation><![CDATA[
477+
Whether the resource chain should cache resource resolution.
478+
Note that the resource content itself won't be cached, but rather Resource instances.
479+
]]></xsd:documentation>
480+
</xsd:annotation>
481+
</xsd:attribute>
482+
<xsd:attribute name="auto-registration" type="xsd:boolean" default="true" use="optional">
483+
<xsd:annotation>
484+
<xsd:documentation><![CDATA[
485+
Whether to register automatically ResourceResolvers and ResourceTransformers.
486+
Setting this property to "false" means that it gives developers full control over the registration process.
487+
]]></xsd:documentation>
488+
</xsd:annotation>
489+
</xsd:attribute>
490+
<xsd:attribute name="cache-manager" type="xsd:string" use="optional">
491+
<xsd:annotation>
492+
<xsd:documentation><![CDATA[
493+
The name of the Cache Manager to cache resource resolution. By default, a ConcurrentCacheMap will be used.
494+
As Resources aren't serializable and can be dependent of the application host, one should not use a
495+
distributed cache but rather an in-memory cache.
496+
]]></xsd:documentation>
497+
</xsd:annotation>
498+
</xsd:attribute>
499+
<xsd:attribute name="cache-name" type="xsd:string" use="optional">
500+
<xsd:annotation>
501+
<xsd:documentation><![CDATA[
502+
The cache name to use in the configured cache manager.
503+
Will use "spring-resource-chain-cache" by default.
504+
]]></xsd:documentation>
505+
</xsd:annotation>
506+
</xsd:attribute>
478507
</xsd:complexType>
479508

480509
<xsd:element name="resources">

0 commit comments

Comments
 (0)