|
34 | 34 | import org.springframework.beans.factory.support.AbstractBeanDefinition; |
35 | 35 | import org.springframework.beans.factory.support.GenericBeanDefinition; |
36 | 36 | import org.springframework.boot.bind.RelaxedBindingNotWritablePropertyException; |
| 37 | +import org.springframework.boot.testutil.InternalOutputCapture; |
37 | 38 | import org.springframework.context.annotation.AnnotationConfigApplicationContext; |
38 | 39 | import org.springframework.context.annotation.Bean; |
39 | 40 | import org.springframework.context.annotation.Configuration; |
@@ -61,6 +62,9 @@ public class ConfigurationPropertiesBindingPostProcessorTests { |
61 | 62 | @Rule |
62 | 63 | public ExpectedException thrown = ExpectedException.none(); |
63 | 64 |
|
| 65 | + @Rule |
| 66 | + public InternalOutputCapture output = new InternalOutputCapture(); |
| 67 | + |
64 | 68 | private AnnotationConfigApplicationContext context; |
65 | 69 |
|
66 | 70 | @After |
@@ -336,6 +340,15 @@ public void bindWithoutConfigurationPropertiesAnnotation() { |
336 | 340 | this.context.refresh(); |
337 | 341 | } |
338 | 342 |
|
| 343 | + @Test |
| 344 | + public void multiplePropertySourcesPlaceholderConfigurer() throws Exception { |
| 345 | + this.context = new AnnotationConfigApplicationContext(); |
| 346 | + this.context.register(MultiplePropertySourcesPlaceholderConfigurer.class); |
| 347 | + this.context.refresh(); |
| 348 | + assertThat(this.output.toString()).contains( |
| 349 | + "Multiple PropertySourcesPlaceholderConfigurer beans registered"); |
| 350 | + } |
| 351 | + |
339 | 352 | private void assertBindingFailure(int errorCount) { |
340 | 353 | try { |
341 | 354 | this.context.refresh(); |
@@ -732,6 +745,22 @@ public static class ConfigurationPropertiesWithoutAnnotation { |
732 | 745 |
|
733 | 746 | } |
734 | 747 |
|
| 748 | + @Configuration |
| 749 | + @EnableConfigurationProperties |
| 750 | + public static class MultiplePropertySourcesPlaceholderConfigurer { |
| 751 | + |
| 752 | + @Bean |
| 753 | + public static PropertySourcesPlaceholderConfigurer configurer1() { |
| 754 | + return new PropertySourcesPlaceholderConfigurer(); |
| 755 | + } |
| 756 | + |
| 757 | + @Bean |
| 758 | + public static PropertySourcesPlaceholderConfigurer configurer2() { |
| 759 | + return new PropertySourcesPlaceholderConfigurer(); |
| 760 | + } |
| 761 | + |
| 762 | + } |
| 763 | + |
735 | 764 | public static class PropertyWithoutConfigurationPropertiesAnnotation { |
736 | 765 |
|
737 | 766 | private String name; |
|
0 commit comments