mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-07-15 01:07:30 +08:00
bf9d23e55a
Previously, the web environment configured on `@SpringBootTest` was not part of the context cache key. As a result, two test classes that has identical configuration other than one using a MOCK web environment and the other using a DEFINED_PORT web environment would share a context when they should not do so. Classes that use MOCK and RANDOM_PORT were not affected as the use of RANDOM_PORT results in a property for the port being added to the environment. This commit adds a new ContextCustomizer, SpringBootTestWebEnvironment, that is used to capture the `webEnvironment` from `@SpringBootTest` and use it in its hashCode and equals implementations. This fixes the problem as all context customizers are evaluated when determing the equality of two context cache keys. Fixes gh-23085 |
||
---|---|---|
.. | ||
src | ||
pom.xml |