If a Servlet is registered by an ServletRegistrationBean the MvcRequestMatcher does not match the mapping for the registered Servlet.
The following code is not matching:
http.authorizeHttpRequests(customizer -> customizer
.requestMatchers("/demoservlet/**").permitAll()
When using antMatcher instead the matcher is working:
http.authorizeHttpRequests(customizer -> customizer
.requestMatchers(antMatcher("/demoservlet/**")).permitAll()
To Reproduce Run the test NotWorkingTest from the sample
Expected behavior WorkingTest from the sample should be successful.
Sample https://github.com/marbon87/spring-security-mvcmatcher-bug-example