From 26331d653a0412bfd42feb7249d23383b7385cf5 Mon Sep 17 00:00:00 2001 From: Alexis SEGURA Date: Fri, 19 Jun 2026 11:20:09 +0200 Subject: [PATCH] Update Javadoc for active profile ordering Following gh-26004, the registration order of active profiles in @ActiveProfiles is preserved. The Javadoc in MergedContextConfiguration and WebMergedContextConfiguration still described the old sorting behavior, which is misleading since profile order is part of the context cache key (equals/hashCode). Signed-off-by: Alexis SEGURA --- .../test/context/MergedContextConfiguration.java | 12 ++++++------ .../context/web/WebMergedContextConfiguration.java | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/spring-test/src/main/java/org/springframework/test/context/MergedContextConfiguration.java b/spring-test/src/main/java/org/springframework/test/context/MergedContextConfiguration.java index 2eed29617c8b..d54188b076b3 100644 --- a/spring-test/src/main/java/org/springframework/test/context/MergedContextConfiguration.java +++ b/spring-test/src/main/java/org/springframework/test/context/MergedContextConfiguration.java @@ -190,8 +190,8 @@ public MergedContextConfiguration(MergedContextConfiguration mergedConfig) { * or {@code propertySourceProperties} an empty array will be stored instead. * If a {@code null} value is supplied for the * {@code contextInitializerClasses} an empty set will be stored instead. - * Furthermore, active profiles will be sorted, and duplicate profiles - * will be removed. + * Furthermore, duplicate active profiles will be removed while preserving + * registration order. * @param testClass the test class for which the configuration was merged * @param locations the merged context resource locations * @param classes the merged annotated classes @@ -229,8 +229,8 @@ public MergedContextConfiguration(Class testClass, String @Nullable [] locati * or {@code propertySourceProperties} an empty array will be stored instead. * If a {@code null} value is supplied for {@code contextInitializerClasses} * or {@code contextCustomizers}, an empty set will be stored instead. - * Furthermore, active profiles will be sorted, and duplicate profiles - * will be removed. + * Furthermore, duplicate active profiles will be removed while preserving + * registration order. * @param testClass the test class for which the configuration was merged * @param locations the merged context resource locations * @param classes the merged annotated classes @@ -268,8 +268,8 @@ public MergedContextConfiguration(Class testClass, String @Nullable [] locati * {@code activeProfiles}, or {@code propertySourceProperties} an empty array * will be stored instead. If a {@code null} value is supplied for * {@code contextInitializerClasses} or {@code contextCustomizers}, an empty - * set will be stored instead. Furthermore, active profiles will be sorted, - * and duplicate profiles will be removed. + * set will be stored instead. Furthermore, duplicate active profiles + * will be removed while preserving registration order. * @param testClass the test class for which the configuration was merged * @param locations the merged context resource locations * @param classes the merged annotated classes diff --git a/spring-test/src/main/java/org/springframework/test/context/web/WebMergedContextConfiguration.java b/spring-test/src/main/java/org/springframework/test/context/web/WebMergedContextConfiguration.java index cd8df132e89f..187acb782110 100644 --- a/spring-test/src/main/java/org/springframework/test/context/web/WebMergedContextConfiguration.java +++ b/spring-test/src/main/java/org/springframework/test/context/web/WebMergedContextConfiguration.java @@ -87,8 +87,8 @@ public WebMergedContextConfiguration(MergedContextConfiguration mergedConfig, St * If a {@code null} value is supplied for the * {@code contextInitializerClasses} an empty set will be stored instead. * If an empty value is supplied for the {@code resourceBasePath} - * an empty string will be used. Furthermore, active profiles will be sorted, - * and duplicate profiles will be removed. + * an empty string will be used. Furthermore, duplicate active profiles + * will be removed while preserving registration order. * @param testClass the test class for which the configuration was merged * @param locations the merged resource locations * @param classes the merged annotated classes @@ -125,8 +125,8 @@ public WebMergedContextConfiguration(Class testClass, String @Nullable [] loc * If a {@code null} value is supplied for {@code contextInitializerClasses} * or {@code contextCustomizers}, an empty set will be stored instead. * If an empty value is supplied for the {@code resourceBasePath} - * an empty string will be used. Furthermore, active profiles will be sorted, - * and duplicate profiles will be removed. + * an empty string will be used. Furthermore, duplicate active profiles + * will be removed while preserving registration order. * @param testClass the test class for which the configuration was merged * @param locations the merged context resource locations * @param classes the merged annotated classes @@ -164,8 +164,8 @@ public WebMergedContextConfiguration(Class testClass, String @Nullable [] loc * {@code activeProfiles}, or {@code propertySourceProperties} an empty array * will be stored instead. If a {@code null} value is supplied for * {@code contextInitializerClasses} or {@code contextCustomizers}, an empty - * set will be stored instead. Furthermore, active profiles will be sorted, - * and duplicate profiles will be removed. + * set will be stored instead. Furthermore, duplicate active profiles + * will be removed while preserving registration order. * @param testClass the test class for which the configuration was merged * @param locations the merged context resource locations * @param classes the merged annotated classes