/** * Add a resource handler for serving static resources based on the specified * URL path patterns. The handler will be invoked for every incoming request * that matches to one of the specified path patterns. * <p>Patterns like {@code "/static/**"} or {@code "/css/{filename:\\w+\\.css}"} * are allowed. See {@link org.springframework.web.util.pattern.PathPattern} * for more details on the syntax. * @return a {@link ResourceHandlerRegistration} to use to further configure * the registered resource handler */ public ResourceHandlerRegistration addResourceHandler(String... patterns) { ResourceHandlerRegistration registration = new ResourceHandlerRegistration(this.resourceLoader, patterns); this.registrations.add(registration); return registration; }
/** * Add a resource handler for serving static resources based on the specified * URL path patterns. The handler will be invoked for every incoming request * that matches to one of the specified path patterns. * * <p>Patterns like {@code "/static/**"} or {@code "/css/{filename:\\w+\\.css}"} * are allowed. See {@link org.springframework.util.AntPathMatcher} for more * details on the syntax. * @return A {@link ResourceHandlerRegistration} to use to further * configure the registered resource handler */ public ResourceHandlerRegistration addResourceHandler(String... patterns) { ResourceHandlerRegistration registration = new ResourceHandlerRegistration(this.applicationContext, patterns); this.registrations.add(registration); return registration; }