Make ConfigurationPropertiesBindingPostProcessor Ordered

pull/50/head
Dave Syer 11 years ago committed by Phillip Webb
parent 2ba01008bb
commit 2b1f629761

@ -35,6 +35,7 @@ import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.EnvironmentAware; import org.springframework.context.EnvironmentAware;
import org.springframework.context.ResourceLoaderAware; import org.springframework.context.ResourceLoaderAware;
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer; import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
import org.springframework.core.Ordered;
import org.springframework.core.annotation.AnnotationUtils; import org.springframework.core.annotation.AnnotationUtils;
import org.springframework.core.convert.ConversionService; import org.springframework.core.convert.ConversionService;
import org.springframework.core.convert.converter.Converter; import org.springframework.core.convert.converter.Converter;
@ -62,7 +63,7 @@ import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean;
*/ */
public class ConfigurationPropertiesBindingPostProcessor implements BeanPostProcessor, public class ConfigurationPropertiesBindingPostProcessor implements BeanPostProcessor,
BeanFactoryAware, ResourceLoaderAware, EnvironmentAware, ApplicationContextAware, BeanFactoryAware, ResourceLoaderAware, EnvironmentAware, ApplicationContextAware,
InitializingBean, DisposableBean { InitializingBean, DisposableBean, Ordered {
public static final String VALIDATOR_BEAN_NAME = "configurationPropertiesValidator"; public static final String VALIDATOR_BEAN_NAME = "configurationPropertiesValidator";
@ -89,6 +90,23 @@ public class ConfigurationPropertiesBindingPostProcessor implements BeanPostProc
private ApplicationContext applicationContext; private ApplicationContext applicationContext;
private int order = Ordered.HIGHEST_PRECEDENCE;
/**
* @param order the order to set
*/
public void setOrder(int order) {
this.order = order;
}
/**
* @return the order
*/
@Override
public int getOrder() {
return this.order;
}
/** /**
* @param propertySources * @param propertySources
*/ */

@ -32,7 +32,8 @@ import org.springframework.core.type.AnnotationMetadata;
public class ConfigurationPropertiesBindingPostProcessorRegistrar implements public class ConfigurationPropertiesBindingPostProcessorRegistrar implements
ImportBeanDefinitionRegistrar { ImportBeanDefinitionRegistrar {
public static final String BINDER_BEAN_NAME = "propertySourcesBinder"; public static final String BINDER_BEAN_NAME = ConfigurationPropertiesBindingPostProcessor.class
.getName();
@Override @Override
public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata,

Loading…
Cancel
Save