File tree 3 files changed +10
-0
lines changed
spring-boot-project/spring-boot/src
main/java/org/springframework/boot
java/org/springframework/boot
3 files changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -338,6 +338,7 @@ private ConfigurableEnvironment prepareEnvironment(SpringApplicationRunListeners
338
338
// Create and configure the environment
339
339
ConfigurableEnvironment environment = getOrCreateEnvironment ();
340
340
configureEnvironment (environment , applicationArguments .getSourceArgs ());
341
+ ConfigurationPropertySources .attach (environment );
341
342
listeners .environmentPrepared (environment );
342
343
bindToSpringApplication (environment );
343
344
if (!this .isCustomEnvironment ) {
Original file line number Diff line number Diff line change @@ -1072,6 +1072,14 @@ public void beanDefinitionOverridingCanBeEnabled() {
1072
1072
.getBean ("someBean" )).isEqualTo ("override" );
1073
1073
}
1074
1074
1075
+ @ Test
1076
+ public void relaxedBindingShouldWorkBeforeEnvironmentIsPrepared () {
1077
+ SpringApplication application = new SpringApplication (ExampleConfig .class );
1078
+ application .setWebApplicationType (WebApplicationType .NONE );
1079
+ this .context = application .run ("--spring.config.additionalLocation=classpath:custom-config/" );
1080
+ assertThat (this .context .getEnvironment ().getProperty ("hello" )).isEqualTo ("world" );
1081
+ }
1082
+
1075
1083
private Condition <ConfigurableEnvironment > matchingPropertySource (final Class <?> propertySourceClass ,
1076
1084
final String name ) {
1077
1085
return new Condition <ConfigurableEnvironment >("has property source" ) {
Original file line number Diff line number Diff line change
1
+ hello : world
You can’t perform that action at this time.
0 commit comments