Class DefaultResourceRegistrationConfigurer

java.lang.Object
com.foreach.across.modules.web.config.resources.DefaultResourceRegistrationConfigurer

@Configuration public class DefaultResourceRegistrationConfigurer extends Object
Applies the caching and versioning configuration for the default module resources. Supports the different properties specified in ResourceConfigurationProperties.

Replacing the default behavior can be done by injecting an extension in the same context.

  • Constructor Details

    • DefaultResourceRegistrationConfigurer

      public DefaultResourceRegistrationConfigurer()
  • Method Details

    • configure

      public void configure(String resourceFolder, org.springframework.web.servlet.config.annotation.ResourceHandlerRegistration registration)
      Apply the default configuration to a ResourceHandlerRegistration that configures a specific type of resource folder (eg. css, js).
      Parameters:
      resourceFolder - name
      registration - entry
    • getCachePeriod

      protected Integer getCachePeriod()
      Returns:
      period to cache resources
    • getFixedVersion

      protected String getFixedVersion()
      Returns:
      configured fixed version to use for versioning strategy
    • shouldApplyFixedVersion

      protected boolean shouldApplyFixedVersion()
      Returns:
      true if versioning is enabled
    • shouldApplyCaching

      protected boolean shouldApplyCaching()
      Returns:
      true if a cache period should be set
    • cacheResourceResolving

      protected boolean cacheResourceResolving()
      Returns:
      true if resource resolving itself should be cached
    • versionResourceResolver

      @Bean @ConditionalOnProperty(prefix="across.web.resources.versioning", value="enabled", matchIfMissing=true) @ConditionalOnMissingBean(value=org.springframework.web.servlet.resource.VersionResourceResolver.class, search=CURRENT) public org.springframework.web.servlet.resource.VersionResourceResolver versionResourceResolver()