|
|
@ -32,8 +32,10 @@ import java.util.stream.Collectors;
|
|
|
|
import org.apache.commons.logging.Log;
|
|
|
|
import org.apache.commons.logging.Log;
|
|
|
|
import org.apache.commons.logging.LogFactory;
|
|
|
|
import org.apache.commons.logging.LogFactory;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import org.springframework.beans.BeansException;
|
|
|
|
import org.springframework.beans.CachedIntrospectionResults;
|
|
|
|
import org.springframework.beans.CachedIntrospectionResults;
|
|
|
|
import org.springframework.beans.factory.config.BeanDefinition;
|
|
|
|
import org.springframework.beans.factory.config.BeanDefinition;
|
|
|
|
|
|
|
|
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
|
|
|
|
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
|
|
|
|
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
|
|
|
|
import org.springframework.beans.factory.groovy.GroovyBeanDefinitionReader;
|
|
|
|
import org.springframework.beans.factory.groovy.GroovyBeanDefinitionReader;
|
|
|
|
import org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory;
|
|
|
|
import org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory;
|
|
|
@ -56,6 +58,7 @@ import org.springframework.context.annotation.AnnotatedBeanDefinitionReader;
|
|
|
|
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
|
|
|
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
|
|
|
import org.springframework.context.annotation.AnnotationConfigUtils;
|
|
|
|
import org.springframework.context.annotation.AnnotationConfigUtils;
|
|
|
|
import org.springframework.context.annotation.ClassPathBeanDefinitionScanner;
|
|
|
|
import org.springframework.context.annotation.ClassPathBeanDefinitionScanner;
|
|
|
|
|
|
|
|
import org.springframework.context.annotation.ConfigurationClassPostProcessor;
|
|
|
|
import org.springframework.context.support.AbstractApplicationContext;
|
|
|
|
import org.springframework.context.support.AbstractApplicationContext;
|
|
|
|
import org.springframework.context.support.GenericApplicationContext;
|
|
|
|
import org.springframework.context.support.GenericApplicationContext;
|
|
|
|
import org.springframework.core.GenericTypeResolver;
|
|
|
|
import org.springframework.core.GenericTypeResolver;
|
|
|
@ -397,6 +400,7 @@ public class SpringApplication {
|
|
|
|
if (this.lazyInitialization) {
|
|
|
|
if (this.lazyInitialization) {
|
|
|
|
context.addBeanFactoryPostProcessor(new LazyInitializationBeanFactoryPostProcessor());
|
|
|
|
context.addBeanFactoryPostProcessor(new LazyInitializationBeanFactoryPostProcessor());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
context.addBeanFactoryPostProcessor(new PropertySourceOrderingBeanFactoryPostProcessor(context));
|
|
|
|
if (!NativeDetector.inNativeImage()) {
|
|
|
|
if (!NativeDetector.inNativeImage()) {
|
|
|
|
// Load the sources
|
|
|
|
// Load the sources
|
|
|
|
Set<Object> sources = getAllSources();
|
|
|
|
Set<Object> sources = getAllSources();
|
|
|
@ -1374,4 +1378,28 @@ public class SpringApplication {
|
|
|
|
return new LinkedHashSet<>(list);
|
|
|
|
return new LinkedHashSet<>(list);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* {@link BeanFactoryPostProcessor} to re-order our property sources below any
|
|
|
|
|
|
|
|
* {@code @PropertySource} items added by the {@link ConfigurationClassPostProcessor}.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
private static class PropertySourceOrderingBeanFactoryPostProcessor implements BeanFactoryPostProcessor, Ordered {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final ConfigurableApplicationContext context;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PropertySourceOrderingBeanFactoryPostProcessor(ConfigurableApplicationContext context) {
|
|
|
|
|
|
|
|
this.context = context;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public int getOrder() {
|
|
|
|
|
|
|
|
return Ordered.HIGHEST_PRECEDENCE;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
|
|
|
|
|
|
|
|
DefaultPropertiesPropertySource.moveToEnd(this.context.getEnvironment());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|