3535import org .springframework .core .Ordered ;
3636import org .springframework .core .PriorityOrdered ;
3737import org .springframework .core .annotation .AnnotationUtils ;
38- import org .springframework .core .convert .ConversionService ;
3938import org .springframework .core .env .ConfigurableEnvironment ;
4039import org .springframework .core .env .Environment ;
4140import org .springframework .core .env .MutablePropertySources ;
42- import org .springframework .core .env .PropertySource ;
4341import org .springframework .core .env .PropertySources ;
4442import org .springframework .core .env .StandardEnvironment ;
45- import org .springframework .validation .Validator ;
4643
4744/**
4845 * {@link BeanPostProcessor} to bind {@link PropertySources} to beans annotated with
@@ -63,61 +60,23 @@ public class ConfigurationPropertiesBindingPostProcessor
6360
6461 private ConfigurationBeanFactoryMetaData beans = new ConfigurationBeanFactoryMetaData ();
6562
66- private Iterable <PropertySource <?>> propertySources ;
67-
68- private Validator validator ;
69-
70- private ConversionService conversionService ;
71-
7263 private BeanFactory beanFactory ;
7364
7465 private Environment environment = new StandardEnvironment ();
7566
7667 private ApplicationContext applicationContext ;
7768
78- private int order = Ordered .HIGHEST_PRECEDENCE + 1 ;
79-
8069 private ConfigurationPropertiesBinder configurationPropertiesBinder ;
8170
82- /**
83- * Set the order of the bean.
84- * @param order the order
85- */
86- public void setOrder (int order ) {
87- this .order = order ;
88- }
71+ private PropertySources propertySources ;
8972
9073 /**
9174 * Return the order of the bean.
9275 * @return the order
9376 */
9477 @ Override
9578 public int getOrder () {
96- return this .order ;
97- }
98-
99- /**
100- * Set the property sources to bind.
101- * @param propertySources the property sources
102- */
103- public void setPropertySources (Iterable <PropertySource <?>> propertySources ) {
104- this .propertySources = propertySources ;
105- }
106-
107- /**
108- * Set the bean validator used to validate property fields.
109- * @param validator the validator
110- */
111- public void setValidator (Validator validator ) {
112- this .validator = validator ;
113- }
114-
115- /**
116- * Set the conversion service used to convert property values.
117- * @param conversionService the conversion service
118- */
119- public void setConversionService (ConversionService conversionService ) {
120- this .conversionService = conversionService ;
79+ return Ordered .HIGHEST_PRECEDENCE + 1 ;
12180 }
12281
12382 /**
@@ -145,9 +104,7 @@ public void setApplicationContext(ApplicationContext applicationContext) {
145104
146105 @ Override
147106 public void afterPropertiesSet () throws Exception {
148- if (this .propertySources == null ) {
149- this .propertySources = deducePropertySources ();
150- }
107+ this .propertySources = deducePropertySources ();
151108 }
152109
153110 private PropertySources deducePropertySources () {
@@ -230,9 +187,8 @@ private ConfigurationProperties getAnnotation(Object bean, String beanName) {
230187 private ConfigurationPropertiesBinder getBinder () {
231188 if (this .configurationPropertiesBinder == null ) {
232189 this .configurationPropertiesBinder = new ConfigurationPropertiesBinderBuilder (
233- this .applicationContext ).withConversionService (this .conversionService )
234- .withValidator (this .validator )
235- .withPropertySources (this .propertySources ).build ();
190+ this .applicationContext ).withPropertySources (this .propertySources )
191+ .build ();
236192 }
237193 return this .configurationPropertiesBinder ;
238194 }
0 commit comments