类 ResourceHandlerRegistry


  • public class ResourceHandlerRegistry
    extends Object
    Stores registrations of resource handlers for serving static resources such as images, css files and others through Spring WebFlux including setting cache headers optimized for efficient loading in a web browser. Resources can be served out of locations under web application root, from the classpath, and others.

    To create a resource handler, use addResourceHandler(String...) providing the URL path patterns for which the handler should be invoked to serve static resources (e.g. "/resources/**").

    Then use additional methods on the returned ResourceHandlerRegistration to add one or more locations from which to serve static content from (e.g. {"/", "classpath:/META-INF/public-web-resources/"}) or to specify a cache period for served resources.

    从以下版本开始:
    5.0
    作者:
    Rossen Stoyanchev, Brian Clozel
    • 构造器详细资料

      • ResourceHandlerRegistry

        public ResourceHandlerRegistry​(ResourceLoader resourceLoader)
        Create a new resource handler registry for the given resource loader (typically an application context).
        参数:
        resourceLoader - the resource loader to use