publicinterfaceEnvironmentextendsPropertyResolver{/**
* Return the set of profiles explicitly made active for this environment. Profiles
* are used for creating logical groupings of bean definitions to be registered
* conditionally,for example based on deployment environment. Profiles can be
* activated by setting {@linkplain AbstractEnvironment#ACTIVE_PROFILES_PROPERTY_NAME
* "spring.profiles.active"} as a system property or by calling
* {@link ConfigurableEnvironment#setActiveProfiles(String...)}.
* <p>If no profiles have explicitly been specified as active,then any
* {@linkplain #getDefaultProfiles() default profiles} will automatically be activated.
* @see #getDefaultProfiles
* @see ConfigurableEnvironment#setActiveProfiles
* @see AbstractEnvironment#ACTIVE_PROFILES_PROPERTY_NAME
*/
String[]getActiveProfiles();/**
* Return the set of profiles to be active by default when no active profiles have
* been set explicitly.
* @see #getActiveProfiles
* @see ConfigurableEnvironment#setDefaultProfiles
* @see AbstractEnvironment#DEFAULT_PROFILES_PROPERTY_NAME
*/
String[]getDefaultProfiles();/**
* Return whether one or more of the given profiles is active or,in the case of no
* explicit active profiles,whether one or more of the given profiles is included in
* the set of default profiles. If a profile begins with '!' the logic is inverted,* i.e. the method will return {@code true} if the given profile is <em>not</em> active.
* For example,{@code env.acceptsProfiles("p1","!p2")} will return {@code true} if
* profile 'p1' is active or 'p2' is not active.
* @throws IllegalArgumentException if called with zero arguments
* or if any profile is {@code null},empty,or whitespace only
* @see #getActiveProfiles
* @see #getDefaultProfiles
* @see #acceptsProfiles(Profiles)
* @deprecated as of 5.1 in favor of {@link #acceptsProfiles(Profiles)}
*/@DeprecatedbooleanacceptsProfiles(String... profiles);/**
* Return whether the {@linkplain #getActiveProfiles() active profiles}
* match the given {@link Profiles} predicate.
*/booleanacceptsProfiles(Profiles profiles);}
它继承了PropertyResolver:
publicinterfacePropertyResolver{/**
* Return whether the given property key is available for resolution,* i.e. if the value for the given key is not {@code null}.
*/booleancontainsProperty(String key);/**
* Return the property value associated with the given key,* or {@code null} if the key cannot be resolved.
* @param key the property name to resolve
* @see #getProperty(String,String)
* @see #getProperty(String,Class)
* @see #getrequiredProperty(String)
*/@Nullable
String getProperty(String key);/**
* Return the property value associated with the given key,or
* {@code defaultValue} if the key cannot be resolved.
* @param key the property name to resolve
* @param defaultValue the default value to return if no value is found
* @see #getrequiredProperty(String)
* @see #getProperty(String,Class)
*/
String getProperty(String key, String defaultValue);/**
* Return the property value associated with the given key,* or {@code null} if the key cannot be resolved.
* @param key the property name to resolve
* @param targetType the expected type of the property value
* @see #getrequiredProperty(String,Class)
*/@Nullable<T> T getProperty(String key, Class<T> targetType);/**
* Return the property value associated with the given key,* or {@code defaultValue} if the key cannot be resolved.
* @param key the property name to resolve
* @param targetType the expected type of the property value
* @param defaultValue the default value to return if no value is found
* @see #getrequiredProperty(String,Class)
*/<T> T getProperty(String key, Class<T> targetType, T defaultValue);/**
* Return the property value associated with the given key (never {@code null}).
* @throws IllegalStateException if the key cannot be resolved
* @see #getrequiredProperty(String,Class)
*/
String getrequiredProperty(String key)throws IllegalStateException;/**
* Return the property value associated with the given key,converted to the given
* targetType (never {@code null}).
* @throws IllegalStateException if the given key cannot be resolved
*/<T> T getrequiredProperty(String key, Class<T> targetType)throws IllegalStateException;/**
* Resolve ${...} placeholders in the given text,replacing them with corresponding
* property values as resolved by {@link #getProperty}. Unresolvable placeholders with
* no default value are ignored and passed through unchanged.
* @param text the String to resolve
* @return the resolved String (never {@code null})
* @throws IllegalArgumentException if given text is {@code null}
* @see #resolverequiredPlaceholders
* @see org.springframework.util.SystemPropertyUtils#resolvePlaceholders(String)
*/
String resolvePlaceholders(String text);/**
* Resolve ${...} placeholders in the given text,replacing them with corresponding
* property values as resolved by {@link #getProperty}. Unresolvable placeholders with
* no default value will cause an IllegalArgumentException to be thrown.
* @return the resolved String (never {@code null})
* @throws IllegalArgumentException if given text is {@code null}
* or if any placeholders are unresolvable
* @see org.springframework.util.SystemPropertyUtils#resolvePlaceholders(String,boolean)
*/
String resolverequiredPlaceholders(String text)throws IllegalArgumentException;}
<beansxmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns:jdbc="http://www.springframework.org/schema/jdbc"xmlns:jee="http://www.springframework.org/schema/jee"xsi:schemaLocation="..."><!-- other bean definitions --><beansprofile="development"><jdbc:embedded-databaseid="dataSource"><jdbc:scriptlocation="classpath:com/bank/config/sql/schema.sql"/><jdbc:scriptlocation="classpath:com/bank/config/sql/test-data.sql"/></jdbc:embedded-database></beans><beansprofile="production"><jee:jndi-lookupid="dataSource"jndi-name="java:comp/env/jdbc/datasource"/></beans></beans>