Class ResourcesConfiguration

java.lang.Object
com.foreach.across.modules.web.config.resources.ResourcesConfiguration
All Implemented Interfaces:
org.springframework.web.servlet.config.annotation.WebMvcConfigurer

@Configuration public class ResourcesConfiguration extends Object implements org.springframework.web.servlet.config.annotation.WebMvcConfigurer
Configuration responsible for registering the static resource resolving with optional support for caching and fixed version.

In case development mode is active, resources will not be cached and physical paths will be detected.

Customizing the default resource configuration can be done by overriding DefaultResourceRegistrationConfigurer and injecting it back into the module context under the same bean name (defaultResourceRegistrationConfigurer).

Author:
Arne Vandamme
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    Configures the ResourceUrlProvider if versioning active.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addResourceHandlers(org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry registry)
     
    void
    reload(ResourceHandlerRegistry resourceHandlerRegistry, org.springframework.context.ApplicationContext applicationContext, Map<String,org.springframework.web.cors.CorsConfiguration> corsConfigurations)
    Reloads the required resources configuration.
    org.springframework.web.servlet.handler.SimpleUrlHandlerMapping
     
    org.springframework.boot.web.servlet.FilterRegistrationBean
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.springframework.web.servlet.config.annotation.WebMvcConfigurer

    addArgumentResolvers, addCorsMappings, addFormatters, addInterceptors, addReturnValueHandlers, addViewControllers, configureAsyncSupport, configureContentNegotiation, configureDefaultServletHandling, configureHandlerExceptionResolvers, configureMessageConverters, configurePathMatch, configureViewResolvers, extendHandlerExceptionResolvers, extendMessageConverters, getMessageCodesResolver, getValidator
  • Field Details

  • Constructor Details

    • ResourcesConfiguration

      public ResourcesConfiguration()
  • Method Details

    • addResourceHandlers

      public void addResourceHandlers(org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry registry)
      Specified by:
      addResourceHandlers in interface org.springframework.web.servlet.config.annotation.WebMvcConfigurer
    • reload

      public void reload(ResourceHandlerRegistry resourceHandlerRegistry, org.springframework.context.ApplicationContext applicationContext, Map<String,org.springframework.web.cors.CorsConfiguration> corsConfigurations)
      Reloads the required resources configuration.
      Parameters:
      resourceHandlerRegistry - containing the registered resources
      applicationContext - triggering the reload
    • resourceHandlerMapping

      @Bean public org.springframework.web.servlet.handler.SimpleUrlHandlerMapping resourceHandlerMapping()
    • resourceUrlEncodingFilterRegistration

      @Bean @ConditionalOnProperty(prefix="across.web.resources.versioning", value="enabled", matchIfMissing=true) @ConditionalOnConfigurableServletContext public org.springframework.boot.web.servlet.FilterRegistrationBean resourceUrlEncodingFilterRegistration()