@ -31,14 +31,11 @@ import java.util.Set;
@@ -31,14 +31,11 @@ import java.util.Set;
import org.apache.commons.logging.Log ;
import org.springframework.beans.BeansException ;
import org.springframework.beans.CachedIntrospectionResults ;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor ;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory ;
import org.springframework.boot.SpringApplication ;
import org.springframework.boot.bind.PropertiesConfigurationFactory ;
import org.springframework.boot.bind.PropertySourcesPropertyValues ;
import org.springframework.boot.bind.RelaxedDataBinder ;
import org.springframework.boot.bind.RelaxedPropertyResolver ;
import org.springframework.boot.context.event.ApplicationEnvironmentPreparedEvent ;
import org.springframework.boot.context.event.ApplicationPreparedEvent ;
import org.springframework.boot.env.EnumerableCompositePropertySource ;
@ -51,8 +48,6 @@ import org.springframework.context.ConfigurableApplicationContext;
@@ -51,8 +48,6 @@ import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.ConfigurationClassPostProcessor ;
import org.springframework.core.Ordered ;
import org.springframework.core.annotation.AnnotationAwareOrderComparator ;
import org.springframework.core.convert.ConversionService ;
import org.springframework.core.convert.support.DefaultConversionService ;
import org.springframework.core.env.ConfigurableEnvironment ;
import org.springframework.core.env.EnumerablePropertySource ;
import org.springframework.core.env.MutablePropertySources ;
@ -65,7 +60,6 @@ import org.springframework.core.io.support.SpringFactoriesLoader;
@@ -65,7 +60,6 @@ import org.springframework.core.io.support.SpringFactoriesLoader;
import org.springframework.util.Assert ;
import org.springframework.util.ResourceUtils ;
import org.springframework.util.StringUtils ;
import org.springframework.validation.BindException ;
/ * *
* { @link EnvironmentPostProcessor } that configures the context environment by loading
@ -89,11 +83,6 @@ import org.springframework.validation.BindException;
@@ -89,11 +83,6 @@ import org.springframework.validation.BindException;
* and the ' spring . config . location ' property can be used to specify alternative search
* locations or specific files .
* < p >
* Configuration properties are also bound to the { @link SpringApplication } . This makes it
* possible to set { @link SpringApplication } properties dynamically , like the sources
* ( "spring.main.sources" - a CSV list ) the flag to indicate a web environment
* ( "spring.main.web_environment=true" ) or the flag to switch off the banner
* ( "spring.main.show_banner=false" ) .
*
* @author Dave Syer
* @author Phillip Webb
@ -149,8 +138,6 @@ public class ConfigFileApplicationListener implements EnvironmentPostProcessor,
@@ -149,8 +138,6 @@ public class ConfigFileApplicationListener implements EnvironmentPostProcessor,
private int order = DEFAULT_ORDER ;
private final ConversionService conversionService = new DefaultConversionService ( ) ;
@Override
public void onApplicationEvent ( ApplicationEvent event ) {
if ( event instanceof ApplicationEnvironmentPreparedEvent ) {
@ -182,19 +169,6 @@ public class ConfigFileApplicationListener implements EnvironmentPostProcessor,
@@ -182,19 +169,6 @@ public class ConfigFileApplicationListener implements EnvironmentPostProcessor,
public void postProcessEnvironment ( ConfigurableEnvironment environment ,
SpringApplication application ) {
addPropertySources ( environment , application . getResourceLoader ( ) ) ;
configureIgnoreBeanInfo ( environment ) ;
bindToSpringApplication ( environment , application ) ;
}
private void configureIgnoreBeanInfo ( ConfigurableEnvironment environment ) {
if ( System . getProperty (
CachedIntrospectionResults . IGNORE_BEANINFO_PROPERTY_NAME ) = = null ) {
RelaxedPropertyResolver resolver = new RelaxedPropertyResolver ( environment ,
"spring.beaninfo." ) ;
Boolean ignore = resolver . getProperty ( "ignore" , Boolean . class , Boolean . TRUE ) ;
System . setProperty ( CachedIntrospectionResults . IGNORE_BEANINFO_PROPERTY_NAME ,
ignore . toString ( ) ) ;
}
}
private void onApplicationPreparedEvent ( ApplicationEvent event ) {
@ -219,26 +193,6 @@ public class ConfigFileApplicationListener implements EnvironmentPostProcessor,
@@ -219,26 +193,6 @@ public class ConfigFileApplicationListener implements EnvironmentPostProcessor,
}
}
/ * *
* Bind the environment to the { @link SpringApplication } .
* @param environment the environment to bind
* @param application the application to bind to
* /
protected void bindToSpringApplication ( ConfigurableEnvironment environment ,
SpringApplication application ) {
PropertiesConfigurationFactory < SpringApplication > binder = new PropertiesConfigurationFactory < SpringApplication > (
application ) ;
binder . setTargetName ( "spring.main" ) ;
binder . setConversionService ( this . conversionService ) ;
binder . setPropertySources ( environment . getPropertySources ( ) ) ;
try {
binder . bindPropertiesToTarget ( ) ;
}
catch ( BindException ex ) {
throw new IllegalStateException ( "Cannot bind to SpringApplication" , ex ) ;
}
}
/ * *
* Add appropriate post - processors to post - configure the property - sources .
* @param context the context to configure