Merge branch '2.7.x'

This commit is contained in:
Andy Wilkinson
2022-04-14 14:53:40 +01:00
8 changed files with 186 additions and 4 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2021 the original author or authors.
* Copyright 2012-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -290,9 +290,13 @@ public class SpringBootTestContextBootstrapper extends DefaultTestContextBootstr
// precedence
propertySourceProperties.addAll(0, Arrays.asList(properties));
}
if (getWebEnvironment(testClass) == WebEnvironment.RANDOM_PORT) {
WebEnvironment webEnvironment = getWebEnvironment(testClass);
if (webEnvironment == WebEnvironment.RANDOM_PORT) {
propertySourceProperties.add("server.port=0");
}
else if (webEnvironment == WebEnvironment.NONE) {
propertySourceProperties.add("spring.main.web-application-type=none");
}
}
/**