Class StandardEnvironment
- All Implemented Interfaces:
- ConfigurableEnvironment,- ConfigurablePropertyResolver,- Environment,- PropertyResolver
- Direct Known Subclasses:
- StandardServletEnvironment
Environment implementation suitable for use in 'standard' (i.e. non-web)
 applications.
 In addition to the usual functions of a ConfigurableEnvironment such as
 property resolution and profile-related operations, this implementation configures two
 default property sources, to be searched in the following order:
 
environment.getProperty("xyz").
 This ordering is chosen by default because system properties are per-JVM, while
 environment variables may be the same across many JVMs on a given system.  Giving
 system properties precedence allows for overriding of environment variables on a
 per-JVM basis.
 These default property sources may be removed, reordered, or replaced; and
 additional property sources may be added using the MutablePropertySources
 instance available from AbstractEnvironment.getPropertySources(). See
 ConfigurableEnvironment Javadoc for usage examples.
 
See SystemEnvironmentPropertySource javadoc for details on special handling
 of property names in shell environments (e.g. Bash) that disallow period characters in
 variable names.
- Since:
- 3.1
- Author:
- Chris Beams, Phillip Webb
- See Also:
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final StringSystem environment property source name: "systemEnvironment".static final StringJVM system properties property source name: "systemProperties".Fields inherited from class org.springframework.core.env.AbstractEnvironmentACTIVE_PROFILES_PROPERTY_NAME, DEFAULT_PROFILES_PROPERTY_NAME, IGNORE_GETENV_PROPERTY_NAME, logger, RESERVED_DEFAULT_PROFILE_NAME
- 
Constructor SummaryConstructorsModifierConstructorDescriptionCreate a newStandardEnvironmentinstance with a defaultMutablePropertySourcesinstance.protectedStandardEnvironment(MutablePropertySources propertySources) Create a newStandardEnvironmentinstance with a specificMutablePropertySourcesinstance.
- 
Method SummaryModifier and TypeMethodDescriptionprotected voidcustomizePropertySources(MutablePropertySources propertySources) Customize the set of property sources with those appropriate for any standard Java environment: "systemProperties" "systemEnvironment"Methods inherited from class org.springframework.core.env.AbstractEnvironmentacceptsProfiles, acceptsProfiles, addActiveProfile, containsProperty, createPropertyResolver, doGetActiveProfiles, doGetActiveProfilesProperty, doGetDefaultProfiles, doGetDefaultProfilesProperty, getActiveProfiles, getConversionService, getDefaultProfiles, getProperty, getProperty, getProperty, getProperty, getPropertyResolver, getPropertySources, getRequiredProperty, getRequiredProperty, getReservedDefaultProfiles, getSystemEnvironment, getSystemProperties, isProfileActive, merge, resolvePlaceholders, resolveRequiredPlaceholders, setActiveProfiles, setConversionService, setDefaultProfiles, setEscapeCharacter, setIgnoreUnresolvableNestedPlaceholders, setPlaceholderPrefix, setPlaceholderSuffix, setRequiredProperties, setValueSeparator, suppressGetenvAccess, toString, validateProfile, validateRequiredPropertiesMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.springframework.core.env.EnvironmentmatchesProfiles
- 
Field Details- 
SYSTEM_ENVIRONMENT_PROPERTY_SOURCE_NAMESystem environment property source name: "systemEnvironment".- See Also:
 
- 
SYSTEM_PROPERTIES_PROPERTY_SOURCE_NAMEJVM system properties property source name: "systemProperties".- See Also:
 
 
- 
- 
Constructor Details- 
StandardEnvironmentpublic StandardEnvironment()Create a newStandardEnvironmentinstance with a defaultMutablePropertySourcesinstance.
- 
StandardEnvironmentCreate a newStandardEnvironmentinstance with a specificMutablePropertySourcesinstance.- Parameters:
- propertySources- property sources to use
- Since:
- 5.3.4
 
 
- 
- 
Method Details- 
customizePropertySourcesCustomize the set of property sources with those appropriate for any standard Java environment:Properties present in "systemProperties" will take precedence over those in "systemEnvironment". 
 
-