Use side-effect free environment with tests rather than converting
Refine the logic introduced in 64270eca to use a side-effect free
Environment implementation rather than converting the Environment early.
Early conversion can cause condition evaluation issues if
`src/test/resources/application.properties` files are bound to the
`SpringApplication`. Specifically the `spring.main.web-application-type`
property can change the `Environment` type which must happen before
conditions are evaluated.
Fixes gh-29169
This commit is contained in:
@@ -389,7 +389,9 @@ public class SpringApplication {
|
||||
* @param environment the environment to convert
|
||||
* @return the converted environment
|
||||
* @since 2.5.7
|
||||
* @deprecated since 2.5.8 for removal in 2.7.0
|
||||
*/
|
||||
@Deprecated
|
||||
public StandardEnvironment convertEnvironment(ConfigurableEnvironment environment) {
|
||||
return new EnvironmentConverter(getClassLoader()).convertEnvironmentIfNecessary(environment,
|
||||
deduceEnvironmentClass());
|
||||
|
||||
Reference in New Issue
Block a user