Class StandardEncryptableServletEnvironment

  • All Implemented Interfaces:
    EncryptableEnvironment, org.springframework.core.env.ConfigurableEnvironment, org.springframework.core.env.ConfigurablePropertyResolver, org.springframework.core.env.Environment, org.springframework.core.env.PropertyResolver, org.springframework.web.context.ConfigurableWebEnvironment

    public class StandardEncryptableServletEnvironment
    extends org.springframework.web.context.support.StandardServletEnvironment
    implements org.springframework.core.env.ConfigurableEnvironment, EncryptableEnvironment
    A custom ConfigurableEnvironment that is useful for early access of encrypted properties on bootstrap. While not required in most scenarios could be useful when customizing Spring Boot's init behavior or integrating with certain capabilities that are configured very early, such as Logging configuration. For a concrete example, this method of enabling encryptable properties is the only one that works with Spring Properties replacement in logback-spring.xml files, using the springProperty tag
    • Field Summary

      • Fields inherited from class org.springframework.web.context.support.StandardServletEnvironment

        JNDI_PROPERTY_SOURCE_NAME, SERVLET_CONFIG_PROPERTY_SOURCE_NAME, SERVLET_CONTEXT_PROPERTY_SOURCE_NAME
      • Fields inherited from class org.springframework.core.env.StandardEnvironment

        SYSTEM_ENVIRONMENT_PROPERTY_SOURCE_NAME, SYSTEM_PROPERTIES_PROPERTY_SOURCE_NAME
      • Fields inherited from class org.springframework.core.env.AbstractEnvironment

        ACTIVE_PROFILES_PROPERTY_NAME, DEFAULT_PROFILES_PROPERTY_NAME, IGNORE_GETENV_PROPERTY_NAME, logger, RESERVED_DEFAULT_PROFILE_NAME
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected org.springframework.core.env.ConfigurablePropertyResolver createPropertyResolver​(org.springframework.core.env.MutablePropertySources propertySources)  
      protected void customizePropertySources​(org.springframework.core.env.MutablePropertySources propertySources)  
      org.springframework.core.env.MutablePropertySources getOriginalPropertySources()  
      org.springframework.core.env.MutablePropertySources getPropertySources()  
      void setEncryptablePropertySources​(org.springframework.core.env.MutablePropertySources propertySources)  
      • Methods inherited from class org.springframework.web.context.support.StandardServletEnvironment

        initPropertySources
      • Methods inherited from class org.springframework.core.env.AbstractEnvironment

        acceptsProfiles, acceptsProfiles, addActiveProfile, containsProperty, doGetActiveProfiles, doGetActiveProfilesProperty, doGetDefaultProfiles, doGetDefaultProfilesProperty, getActiveProfiles, getConversionService, getDefaultProfiles, getProperty, getProperty, getProperty, getProperty, getPropertyResolver, getRequiredProperty, getRequiredProperty, getReservedDefaultProfiles, getSystemEnvironment, getSystemProperties, isProfileActive, merge, resolvePlaceholders, resolveRequiredPlaceholders, setActiveProfiles, setConversionService, setDefaultProfiles, setIgnoreUnresolvableNestedPlaceholders, setPlaceholderPrefix, setPlaceholderSuffix, setRequiredProperties, setValueSeparator, suppressGetenvAccess, toString, validateProfile, validateRequiredProperties
      • Methods inherited from interface org.springframework.core.env.ConfigurableEnvironment

        addActiveProfile, getSystemEnvironment, getSystemProperties, merge, setActiveProfiles, setDefaultProfiles
      • Methods inherited from interface org.springframework.core.env.ConfigurablePropertyResolver

        getConversionService, setConversionService, setIgnoreUnresolvableNestedPlaceholders, setPlaceholderPrefix, setPlaceholderSuffix, setRequiredProperties, setValueSeparator, validateRequiredProperties
      • Methods inherited from interface org.springframework.core.env.Environment

        acceptsProfiles, acceptsProfiles, getActiveProfiles, getDefaultProfiles
      • Methods inherited from interface org.springframework.core.env.PropertyResolver

        containsProperty, getProperty, getProperty, getProperty, getProperty, getRequiredProperty, getRequiredProperty, resolvePlaceholders, resolveRequiredPlaceholders
    • Constructor Detail

      • StandardEncryptableServletEnvironment

        public StandardEncryptableServletEnvironment()
      • StandardEncryptableServletEnvironment

        public StandardEncryptableServletEnvironment​(InterceptionMode interceptionMode,
                                                     InterceptionMode propertySourcesInterceptionMode,
                                                     List<Class<org.springframework.core.env.PropertySource<?>>> skipPropertySourceClasses,
                                                     EncryptablePropertyResolver resolver,
                                                     EncryptablePropertyFilter filter,
                                                     org.jasypt.encryption.StringEncryptor encryptor,
                                                     EncryptablePropertyDetector detector)
        Create a new Encryptable Environment. All arguments are optional, provide null if default value is desired.
        Parameters:
        interceptionMode - The interception method to utilize, or null (Default is InterceptionMode.WRAPPER)
        propertySourcesInterceptionMode - The interception method to utilize for wrapping the MutablePropertySources, or null (Default is InterceptionMode.WRAPPER)
        skipPropertySourceClasses - A list of PropertySource classes to skip from interception, or null (Default is empty)
        resolver - The property resolver to utilize, or null (Default is DefaultLazyPropertyResolver which will resolve to specified configuration)
        filter - The property filter to utilize, or null (Default is DefaultLazyPropertyFilter which will resolve to specified configuration)
        encryptor - The string encryptor to utilize, or null (Default is DefaultLazyEncryptor which will resolve to specified configuration)
        detector - The property detector to utilize, or null (Default is DefaultLazyPropertyDetector which will resolve to specified configuration)
    • Method Detail

      • customizePropertySources

        protected void customizePropertySources​(org.springframework.core.env.MutablePropertySources propertySources)
        Overrides:
        customizePropertySources in class org.springframework.web.context.support.StandardServletEnvironment
      • getPropertySources

        public org.springframework.core.env.MutablePropertySources getPropertySources()
        Specified by:
        getPropertySources in interface org.springframework.core.env.ConfigurableEnvironment
        Overrides:
        getPropertySources in class org.springframework.core.env.AbstractEnvironment
      • createPropertyResolver

        protected org.springframework.core.env.ConfigurablePropertyResolver createPropertyResolver​(org.springframework.core.env.MutablePropertySources propertySources)
        Overrides:
        createPropertyResolver in class org.springframework.core.env.AbstractEnvironment