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

addResourceLocations

open fun addResourceLocations(vararg resourceLocations: String): ResourceHandlerRegistration

Add one or more resource locations from which to serve static content. Each location must point to a valid directory. Multiple locations may be specified as a comma-separated list, and the locations will be checked for a given resource in the order specified.

For example, {"/", "classpath:/META-INF/public-web-resources/"} allows resources to be served both from the web application root and from any JAR on the classpath that contains a /META-INF/public-web-resources/ directory, with resources in the web application root taking precedence.

For org.springframework.core.io.UrlResource (e.g. files, HTTP URLs, etc) this method supports a special prefix to indicate the charset associated with the URL so that relative paths appended to it can be encoded correctly, e.g. [charset=Windows-31J]http://example.org/path.

Return
the same ResourceHandlerRegistration instance, for chained method invocation