org.springframework.core.env
Interface ConfigurableEnvironment

All Superinterfaces:
ConfigurablePropertyResolver, Environment, PropertyResolver
All Known Implementing Classes:
AbstractEnvironment, DefaultEnvironment, DefaultPortletEnvironment, DefaultWebEnvironment

public interface ConfigurableEnvironment
extends Environment, ConfigurablePropertyResolver

Configuration interface to be implemented by most if not all Environments. Provides facilities for setting active and default profiles as well as accessing the property sources.

Since:
3.1
Author:
Chris Beams
See Also:
DefaultEnvironment, ConfigurableApplicationContext.getEnvironment()

Method Summary
 MutablePropertySources getPropertySources()
          Return the PropertySources for this environment in mutable form
 Map<String,Object> getSystemEnvironment()
          Return the value of System.getenv() if allowed by the current SecurityManager, otherwise return a map implementation that will attempt to access individual keys using calls to System.getenv(String).
 Map<String,Object> getSystemProperties()
          Return the value of System.getProperties() if allowed by the current SecurityManager, otherwise return a map implementation that will attempt to access individual keys using calls to System.getProperty(String).
 void setActiveProfiles(String... profiles)
          Specify the set of profiles active for this Environment.
 void setDefaultProfiles(String... profiles)
          Specify the set of profiles to be made active by default if no other profiles are explicitly made active through setActiveProfiles(java.lang.String...).
 
Methods inherited from interface org.springframework.core.env.Environment
acceptsProfiles, getActiveProfiles, getDefaultProfiles
 
Methods inherited from interface org.springframework.core.env.ConfigurablePropertyResolver
getConversionService, setConversionService, setPlaceholderPrefix, setPlaceholderSuffix, setValueSeparator
 
Methods inherited from interface org.springframework.core.env.PropertyResolver
containsProperty, getProperty, getProperty, getRequiredProperty, getRequiredProperty, resolvePlaceholders, resolveRequiredPlaceholders
 

Method Detail

setActiveProfiles

void setActiveProfiles(String... profiles)
Specify the set of profiles active for this Environment. Profiles are evaluated during container bootstrap to determine whether bean definitions should be registered with the container.

See Also:
setDefaultProfiles(java.lang.String...), Profile, AbstractEnvironment.ACTIVE_PROFILES_PROPERTY_NAME

setDefaultProfiles

void setDefaultProfiles(String... profiles)
Specify the set of profiles to be made active by default if no other profiles are explicitly made active through setActiveProfiles(java.lang.String...).

See Also:
AbstractEnvironment.DEFAULT_PROFILES_PROPERTY_NAME

getPropertySources

MutablePropertySources getPropertySources()
Return the PropertySources for this environment in mutable form


getSystemEnvironment

Map<String,Object> getSystemEnvironment()
Return the value of System.getenv() if allowed by the current SecurityManager, otherwise return a map implementation that will attempt to access individual keys using calls to System.getenv(String).

Note that most Environment implementations will include this system environment map as a default PropertySource to be searched. Therefore, it is recommended that this method not be used directly unless bypassing other property sources is expressly intended.

Calls to Map.get(Object) on the Map returned will never throw IllegalAccessException; in cases where the SecurityManager forbids access to a property, null will be returned and an INFO-level log message will be issued noting the exception.


getSystemProperties

Map<String,Object> getSystemProperties()
Return the value of System.getProperties() if allowed by the current SecurityManager, otherwise return a map implementation that will attempt to access individual keys using calls to System.getProperty(String).

Note that most Environment implementations will include this system properties map as a default PropertySource to be searched. Therefore, it is recommended that this method not be used directly unless bypassing other property sources is expressly intended.

Calls to Map.get(Object) on the Map returned will never throw IllegalAccessException; in cases where the SecurityManager forbids access to a property, null will be returned and an INFO-level log message will be issued noting the exception.