diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/SecurityProperties.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/SecurityProperties.java index 4ad92e79fb..c3d5fcdd3f 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/SecurityProperties.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/SecurityProperties.java @@ -17,8 +17,7 @@ package org.springframework.boot.autoconfigure.security; import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashSet; +import java.util.EnumSet; import java.util.List; import java.util.Set; import java.util.UUID; @@ -83,8 +82,7 @@ public class SecurityProperties { /** * Security filter chain dispatcher types. */ - private Set dispatcherTypes = new HashSet<>(Arrays.asList(DispatcherType.ASYNC, - DispatcherType.ERROR, DispatcherType.REQUEST, DispatcherType.FORWARD, DispatcherType.INCLUDE)); + private Set dispatcherTypes = EnumSet.allOf(DispatcherType.class); public int getOrder() { return this.order; diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/servlet/SecurityAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/servlet/SecurityAutoConfigurationTests.java index 264d8d33c4..6c1aa5d731 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/servlet/SecurityAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/servlet/SecurityAutoConfigurationTests.java @@ -17,6 +17,7 @@ package org.springframework.boot.autoconfigure.security.servlet; import java.security.interfaces.RSAPublicKey; +import java.util.EnumSet; import jakarta.servlet.DispatcherType; import org.assertj.core.api.InstanceOfAssertFactories; @@ -161,8 +162,7 @@ class SecurityAutoConfigurationTests { DelegatingFilterProxyRegistrationBean.class); assertThat(bean) .extracting("dispatcherTypes", InstanceOfAssertFactories.iterable(DispatcherType.class)) - .containsOnly(DispatcherType.ASYNC, DispatcherType.ERROR, DispatcherType.REQUEST, - DispatcherType.INCLUDE, DispatcherType.FORWARD); + .containsOnly(EnumSet.allOf(DispatcherType.class).toArray(new DispatcherType[0])); }); }