diff --git a/config/src/main/java/org/springframework/security/config/annotation/SecurityConfigurerAdapter.java b/config/src/main/java/org/springframework/security/config/annotation/SecurityConfigurerAdapter.java index a68dd2c409..49fa1d41a8 100644 --- a/config/src/main/java/org/springframework/security/config/annotation/SecurityConfigurerAdapter.java +++ b/config/src/main/java/org/springframework/security/config/annotation/SecurityConfigurerAdapter.java @@ -134,7 +134,7 @@ public abstract class SecurityConfigurerAdapter> private boolean addObjectPostProcessor( ObjectPostProcessor objectPostProcessor) { boolean result = this.postProcessors.add(objectPostProcessor); - Collections.sort(postProcessors, AnnotationAwareOrderComparator.INSTANCE); + postProcessors.sort(AnnotationAwareOrderComparator.INSTANCE); return result; } } diff --git a/config/src/main/java/org/springframework/security/config/annotation/authentication/configuration/AuthenticationConfiguration.java b/config/src/main/java/org/springframework/security/config/annotation/authentication/configuration/AuthenticationConfiguration.java index 56e0ecfd67..002f4fb6b1 100644 --- a/config/src/main/java/org/springframework/security/config/annotation/authentication/configuration/AuthenticationConfiguration.java +++ b/config/src/main/java/org/springframework/security/config/annotation/authentication/configuration/AuthenticationConfiguration.java @@ -129,7 +129,7 @@ public class AuthenticationConfiguration { @Autowired(required = false) public void setGlobalAuthenticationConfigurers( List configurers) throws Exception { - Collections.sort(configurers, AnnotationAwareOrderComparator.INSTANCE); + configurers.sort(AnnotationAwareOrderComparator.INSTANCE); this.globalAuthConfigurers = configurers; } diff --git a/config/src/main/java/org/springframework/security/config/annotation/web/builders/HttpSecurity.java b/config/src/main/java/org/springframework/security/config/annotation/web/builders/HttpSecurity.java index 69bc3ab70c..66d6db4721 100644 --- a/config/src/main/java/org/springframework/security/config/annotation/web/builders/HttpSecurity.java +++ b/config/src/main/java/org/springframework/security/config/annotation/web/builders/HttpSecurity.java @@ -2327,7 +2327,7 @@ public final class HttpSecurity extends @Override protected DefaultSecurityFilterChain performBuild() throws Exception { - Collections.sort(filters, comparator); + filters.sort(comparator); return new DefaultSecurityFilterChain(requestMatcher, filters); } diff --git a/config/src/main/java/org/springframework/security/config/annotation/web/configuration/WebSecurityConfiguration.java b/config/src/main/java/org/springframework/security/config/annotation/web/configuration/WebSecurityConfiguration.java index 028da2aecd..cccae55887 100644 --- a/config/src/main/java/org/springframework/security/config/annotation/web/configuration/WebSecurityConfiguration.java +++ b/config/src/main/java/org/springframework/security/config/annotation/web/configuration/WebSecurityConfiguration.java @@ -139,7 +139,7 @@ public class WebSecurityConfiguration implements ImportAware, BeanClassLoaderAwa webSecurity.debug(debugEnabled); } - Collections.sort(webSecurityConfigurers, AnnotationAwareOrderComparator.INSTANCE); + webSecurityConfigurers.sort(AnnotationAwareOrderComparator.INSTANCE); Integer previousOrder = null; Object previousConfig = null; diff --git a/config/src/main/java/org/springframework/security/config/http/HttpSecurityBeanDefinitionParser.java b/config/src/main/java/org/springframework/security/config/http/HttpSecurityBeanDefinitionParser.java index 9506d3089b..1c2859d370 100644 --- a/config/src/main/java/org/springframework/security/config/http/HttpSecurityBeanDefinitionParser.java +++ b/config/src/main/java/org/springframework/security/config/http/HttpSecurityBeanDefinitionParser.java @@ -164,7 +164,7 @@ public class HttpSecurityBeanDefinitionParser implements BeanDefinitionParser { unorderedFilterChain.addAll(authBldr.getFilters()); unorderedFilterChain.addAll(buildCustomFilterList(element, pc)); - Collections.sort(unorderedFilterChain, new OrderComparator()); + unorderedFilterChain.sort(new OrderComparator()); checkFilterChainOrder(unorderedFilterChain, pc, pc.extractSource(element)); // The list of filter beans