spring-framework / org.springframework.web.reactive.resource / VersionResourceResolver / addFixedVersionStrategy

addFixedVersionStrategy

open fun addFixedVersionStrategy(version: String, vararg pathPatterns: String): VersionResourceResolver

Insert a fixed, prefix-based version in resource URLs that match the given path patterns, for example: "{version}/js/main.js". This is useful (vs. content-based versions) when using JavaScript module loaders.

The version may be a random number, the current date, or a value fetched from a git commit sha, a property file, or environment variable and set with SpEL expressions in the configuration (e.g. see @Value in Java config).

If not done already, variants of the given pathPatterns, prefixed with the version will be also configured. For example, adding a "/js/**" path pattern will also cofigure automatically a "/v1.0.0/js/**" with "v1.0.0" the version String given as an argument.

Parameters

version - a version string

pathPatterns - one or more resource URL path patterns, relative to the pattern configured with the resource handler

Return
the current instance for chained method invocation

See Also
FixedVersionStrategy