Merge branch '2.5.x' into main
Closes gh-28724
This commit is contained in:
@@ -341,13 +341,24 @@ public class SpringApplication {
|
||||
"Environment prefix cannot be set via properties.");
|
||||
bindToSpringApplication(environment);
|
||||
if (!this.isCustomEnvironment) {
|
||||
environment = new EnvironmentConverter(getClassLoader()).convertEnvironmentIfNecessary(environment,
|
||||
deduceEnvironmentClass());
|
||||
environment = convertEnvironment(environment);
|
||||
}
|
||||
ConfigurationPropertySources.attach(environment);
|
||||
return environment;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the given {@link ConfigurableEnvironment environment} to an application
|
||||
* environment that doesn't attempt to resolve profile properties directly.
|
||||
* @param environment the environment to convert
|
||||
* @return the converted environment
|
||||
* @since 2.5.7
|
||||
*/
|
||||
public StandardEnvironment convertEnvironment(ConfigurableEnvironment environment) {
|
||||
return new EnvironmentConverter(getClassLoader()).convertEnvironmentIfNecessary(environment,
|
||||
deduceEnvironmentClass());
|
||||
}
|
||||
|
||||
private Class<? extends StandardEnvironment> deduceEnvironmentClass() {
|
||||
switch (this.webApplicationType) {
|
||||
case SERVLET:
|
||||
|
||||
Reference in New Issue
Block a user