diff --git a/config/src/main/java/org/springframework/security/config/annotation/web/AbstractRequestMatcherRegistry.java b/config/src/main/java/org/springframework/security/config/annotation/web/AbstractRequestMatcherRegistry.java index 0cf3cb7e04..0f779f2df3 100644 --- a/config/src/main/java/org/springframework/security/config/annotation/web/AbstractRequestMatcherRegistry.java +++ b/config/src/main/java/org/springframework/security/config/annotation/web/AbstractRequestMatcherRegistry.java @@ -509,7 +509,8 @@ public abstract class AbstractRequestMatcherRegistry { public boolean matches(HttpServletRequest request) { String name = request.getHttpServletMapping().getServletName(); ServletRegistration registration = this.servletContext.getServletRegistration(name); - Assert.notNull(registration, computeErrorMessage(this.servletContext.getServletRegistrations().values())); + Assert.notNull(registration, + () -> computeErrorMessage(this.servletContext.getServletRegistrations().values())); try { Class clazz = Class.forName(registration.getClassName()); return DispatcherServlet.class.isAssignableFrom(clazz);