spring-framework / org.springframework.web.servlet.config.annotation / ResourceHandlerRegistration / resourceChain

resourceChain

open fun resourceChain(cacheResources: Boolean): ResourceChainRegistration

Configure a chain of resource resolvers and transformers to use. This can be useful, for example, to apply a version strategy to resource URLs.

If this method is not invoked, by default only a simple PathResourceResolver is used in order to match URL paths to resources under the configured locations.

Parameters

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)

Return
the same ResourceHandlerRegistration instance, for chained method invocation

Since
4.1

open fun resourceChain(cacheResources: Boolean, cache: Cache): ResourceChainRegistration

Configure a chain of resource resolvers and transformers to use. This can be useful, for example, to apply a version strategy to resource URLs.

If this method is not invoked, by default only a simple PathResourceResolver is used in order to match URL paths to resources under the configured locations.

Parameters

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

cache - the cache to use for storing resolved and transformed resources; by default a org.springframework.cache.concurrent.ConcurrentMapCache is used. Since Resources aren't serializable and can be dependent on the application host, one should not use a distributed cache but rather an in-memory cache.

Return
the same ResourceHandlerRegistration instance, for chained method invocation

Since
4.1