Class StandardEncryptableEnvironment
java.lang.Object
org.springframework.core.env.AbstractEnvironment
org.springframework.core.env.StandardEnvironment
com.ulisesbocchio.jasyptspringboot.environment.StandardEncryptableEnvironment
- All Implemented Interfaces:
EncryptableEnvironment,org.springframework.core.env.ConfigurableEnvironment,org.springframework.core.env.ConfigurablePropertyResolver,org.springframework.core.env.Environment,org.springframework.core.env.PropertyResolver
public class StandardEncryptableEnvironment
extends org.springframework.core.env.StandardEnvironment
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- Version:
- $Id: $Id
- Author:
- Sergio.U.Bocchio
-
Field Summary
Fields inherited from class org.springframework.core.env.StandardEnvironment
SYSTEM_ENVIRONMENT_PROPERTY_SOURCE_NAME, SYSTEM_PROPERTIES_PROPERTY_SOURCE_NAMEFields 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 -
Constructor Summary
ConstructorsConstructorDescriptionConstructor for StandardEncryptableEnvironment.StandardEncryptableEnvironment(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. -
Method Summary
Modifier and TypeMethodDescriptionprotected org.springframework.core.env.ConfigurablePropertyResolvercreatePropertyResolver(org.springframework.core.env.MutablePropertySources propertySources) protected voidcustomizePropertySources(org.springframework.core.env.MutablePropertySources propertySources) org.springframework.core.env.MutablePropertySourcesgetOriginalPropertySources.org.springframework.core.env.MutablePropertySourcesvoidmerge(org.springframework.core.env.ConfigurableEnvironment parent) voidsetEncryptablePropertySources(org.springframework.core.env.MutablePropertySources propertySources) setEncryptablePropertySources.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, resolvePlaceholders, resolveRequiredPlaceholders, setActiveProfiles, setConversionService, setDefaultProfiles, setEscapeCharacter, setIgnoreUnresolvableNestedPlaceholders, setPlaceholderPrefix, setPlaceholderSuffix, setRequiredProperties, setValueSeparator, suppressGetenvAccess, toString, validateProfile, validateRequiredPropertiesMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.springframework.core.env.ConfigurableEnvironment
addActiveProfile, getSystemEnvironment, getSystemProperties, setActiveProfiles, setDefaultProfilesMethods inherited from interface org.springframework.core.env.ConfigurablePropertyResolver
getConversionService, setConversionService, setEscapeCharacter, setIgnoreUnresolvableNestedPlaceholders, setPlaceholderPrefix, setPlaceholderSuffix, setRequiredProperties, setValueSeparator, validateRequiredPropertiesMethods inherited from interface org.springframework.core.env.Environment
acceptsProfiles, acceptsProfiles, getActiveProfiles, getDefaultProfiles, matchesProfilesMethods inherited from interface org.springframework.core.env.PropertyResolver
containsProperty, getProperty, getProperty, getProperty, getProperty, getRequiredProperty, getRequiredProperty, resolvePlaceholders, resolveRequiredPlaceholders
-
Constructor Details
-
StandardEncryptableEnvironment
public StandardEncryptableEnvironment()Constructor for StandardEncryptableEnvironment.
-
StandardEncryptableEnvironment
public StandardEncryptableEnvironment(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 isInterceptionMode.WRAPPER)propertySourcesInterceptionMode- The interception method to utilize for wrapping theMutablePropertySources, or null (Default isInterceptionMode.WRAPPER)skipPropertySourceClasses- A list ofPropertySourceclasses to skip from interception, or null (Default is empty)resolver- The property resolver to utilize, or null (Default isDefaultLazyPropertyResolverwhich will resolve to specified configuration)filter- The property filter to utilize, or null (Default isDefaultLazyPropertyFilterwhich will resolve to specified configuration)encryptor- The string encryptor to utilize, or null (Default isDefaultLazyEncryptorwhich will resolve to specified configuration)detector- The property detector to utilize, or null (Default isDefaultLazyPropertyDetectorwhich will resolve to specified configuration)
-
-
Method Details
-
customizePropertySources
protected void customizePropertySources(org.springframework.core.env.MutablePropertySources propertySources) - Overrides:
customizePropertySourcesin classorg.springframework.core.env.StandardEnvironment
-
merge
public void merge(org.springframework.core.env.ConfigurableEnvironment parent) - Specified by:
mergein interfaceorg.springframework.core.env.ConfigurableEnvironment- Overrides:
mergein classorg.springframework.core.env.AbstractEnvironment
-
getPropertySources
public org.springframework.core.env.MutablePropertySources getPropertySources()- Specified by:
getPropertySourcesin interfaceorg.springframework.core.env.ConfigurableEnvironment- Overrides:
getPropertySourcesin classorg.springframework.core.env.AbstractEnvironment
-
getOriginalPropertySources
public org.springframework.core.env.MutablePropertySources getOriginalPropertySources()getOriginalPropertySources.
- Specified by:
getOriginalPropertySourcesin interfaceEncryptableEnvironment- Returns:
- a
MutablePropertySourcesobject
-
setEncryptablePropertySources
public void setEncryptablePropertySources(org.springframework.core.env.MutablePropertySources propertySources) setEncryptablePropertySources.
- Specified by:
setEncryptablePropertySourcesin interfaceEncryptableEnvironment- Parameters:
propertySources- aMutablePropertySourcesobject
-
createPropertyResolver
protected org.springframework.core.env.ConfigurablePropertyResolver createPropertyResolver(org.springframework.core.env.MutablePropertySources propertySources) - Overrides:
createPropertyResolverin classorg.springframework.core.env.AbstractEnvironment
-