|
|
|
|
@ -65,6 +65,7 @@ import org.springframework.boot.convert.DurationUnit;
@@ -65,6 +65,7 @@ import org.springframework.boot.convert.DurationUnit;
|
|
|
|
|
import org.springframework.boot.convert.PeriodFormat; |
|
|
|
|
import org.springframework.boot.convert.PeriodStyle; |
|
|
|
|
import org.springframework.boot.convert.PeriodUnit; |
|
|
|
|
import org.springframework.boot.env.RandomValuePropertySource; |
|
|
|
|
import org.springframework.boot.testsupport.system.CapturedOutput; |
|
|
|
|
import org.springframework.boot.testsupport.system.OutputCaptureExtension; |
|
|
|
|
import org.springframework.context.annotation.AnnotationConfigApplicationContext; |
|
|
|
|
@ -1061,6 +1062,18 @@ class ConfigurationPropertiesTests {
@@ -1061,6 +1062,18 @@ class ConfigurationPropertiesTests {
|
|
|
|
|
assertThat(bean.getA()).isEqualTo("baz"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test // gh-26201
|
|
|
|
|
void loadWhenBoundToRandomPropertyPlaceholder() { |
|
|
|
|
MutablePropertySources sources = this.context.getEnvironment().getPropertySources(); |
|
|
|
|
sources.addFirst(new RandomValuePropertySource()); |
|
|
|
|
Map<String, Object> source = new HashMap<>(); |
|
|
|
|
source.put("com.example.bar", "${random.int}"); |
|
|
|
|
sources.addLast(new MapPropertySource("test", source)); |
|
|
|
|
load(SimplePrefixedProperties.class); |
|
|
|
|
SimplePrefixedProperties bean = this.context.getBean(SimplePrefixedProperties.class); |
|
|
|
|
assertThat(bean.getBar()).isNotNull().containsOnlyDigits(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
void boundPropertiesShouldBeRecorded() { |
|
|
|
|
load(NestedConfiguration.class, "name=foo", "nested.name=bar"); |
|
|
|
|
|