From 2b1f629761f5f433192b5aaf29c543e38591a133 Mon Sep 17 00:00:00 2001 From: Dave Syer Date: Wed, 4 Sep 2013 18:07:43 +0100 Subject: [PATCH] Make ConfigurationPropertiesBindingPostProcessor Ordered --- ...urationPropertiesBindingPostProcessor.java | 20 ++++++++++++++++++- ...opertiesBindingPostProcessorRegistrar.java | 3 ++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationPropertiesBindingPostProcessor.java b/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationPropertiesBindingPostProcessor.java index fc03c6cb3c..a207a06fe7 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationPropertiesBindingPostProcessor.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationPropertiesBindingPostProcessor.java @@ -35,6 +35,7 @@ import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.EnvironmentAware; import org.springframework.context.ResourceLoaderAware; import org.springframework.context.support.PropertySourcesPlaceholderConfigurer; +import org.springframework.core.Ordered; import org.springframework.core.annotation.AnnotationUtils; import org.springframework.core.convert.ConversionService; import org.springframework.core.convert.converter.Converter; @@ -62,7 +63,7 @@ import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean; */ public class ConfigurationPropertiesBindingPostProcessor implements BeanPostProcessor, BeanFactoryAware, ResourceLoaderAware, EnvironmentAware, ApplicationContextAware, - InitializingBean, DisposableBean { + InitializingBean, DisposableBean, Ordered { public static final String VALIDATOR_BEAN_NAME = "configurationPropertiesValidator"; @@ -89,6 +90,23 @@ public class ConfigurationPropertiesBindingPostProcessor implements BeanPostProc 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 */ diff --git a/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationPropertiesBindingPostProcessorRegistrar.java b/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationPropertiesBindingPostProcessorRegistrar.java index 728d43e05b..04489109a8 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationPropertiesBindingPostProcessorRegistrar.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationPropertiesBindingPostProcessorRegistrar.java @@ -32,7 +32,8 @@ import org.springframework.core.type.AnnotationMetadata; public class ConfigurationPropertiesBindingPostProcessorRegistrar implements ImportBeanDefinitionRegistrar { - public static final String BINDER_BEAN_NAME = "propertySourcesBinder"; + public static final String BINDER_BEAN_NAME = ConfigurationPropertiesBindingPostProcessor.class + .getName(); @Override public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata,