Skip to content

Commit 0155d4a

Browse files
committed
Restore Check for DispatcherServlet on Classpath
Closes gh-18315
1 parent 29ad1e6 commit 0155d4a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

config/src/main/java/org/springframework/security/config/annotation/method/configuration/MethodSecuritySelector.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ final class MethodSecuritySelector implements ImportSelector {
4242
.isPresent("org.springframework.security.data.aot.hint.AuthorizeReturnObjectDataHintsRegistrar", null);
4343

4444
private static final boolean isWebPresent = ClassUtils
45-
.isPresent("org.springframework.security.web.util.ThrowableAnalyzer", null);
45+
.isPresent("org.springframework.web.servlet.DispatcherServlet", null)
46+
&& ClassUtils.isPresent("org.springframework.security.web.util.ThrowableAnalyzer", null);
4647

4748
private static final boolean isObservabilityPresent = ClassUtils
4849
.isPresent("io.micrometer.observation.ObservationRegistry", null);

0 commit comments

Comments
 (0)