6

I'm currently using Spring boot updated version 3.2.0 and implemented the SecurityFilterChain after running the application I got this message:

2023-12-11T12:08:04.541+06:00 WARN 28000 --- [nio-8080-exec-1] o.s.w.s.h.HandlerMappingIntrospector : Cache miss for REQUEST dispatch to '/' (previous null). Performing CorsConfiguration lookup. This is logged once only at WARN level, and every time at TRACE. 2023-12-11T12:08:04.550+06:00 WARN 28000 --- [nio-8080-exec-1] o.s.w.s.h.HandlerMappingIntrospector : Cache miss for REQUEST dispatch to '/' (previous null). Performing MatchableHandlerMapping lookup. This is logged once only at WARN level, and every time at TRACE. 

The Code of SecurityFilterChain:

@Bean public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception { http .authorizeHttpRequests((requests) -> requests .requestMatchers("/", "/Signup", "/css/**", "/js/**").permitAll() .anyRequest().authenticated() ) .formLogin((form) -> form .loginPage("/Login") .permitAll() ) .logout((logout) -> logout.permitAll()) .formLogin((form) -> form.defaultSuccessUrl("/home", true)); return http.build(); } 

Any idea why I got this message. When I hit localhost:8080 automatically goes to login page its fine but won't go to signup page when I clicked on signup button it just redirect to login page. Can you provide details working process and to resolve the problem.

I followed the official documentation to implement SecurityFilterChain

Thank you in advance.

0

2 Answers 2

3

I just ran into this WARNING when upgrading a project's Spring Boot version.

This is a current issue with Spring Boot 3.2.0. It should be fixed with this ticket.

In the meantime we can change the logging level to error:

logging.level.org.springframework.web.servlet.handler.HandlerMappingIntrospector=ERROR 
Sign up to request clarification or add additional context in comments.

3 Comments

I thought that the warning was the problem when I pressed signup and it automatically redirected to the login page. Why am I getting unusual behaviour? Any idea!
MvcRequestMatcher that will be used with your configuration is case sensitive, perhaps you should check if the sign-up path you are hitting is not different than the one configured. Also you shouldn't really need two .formLogin() configurations.
Please check it out the project. [Project] (github.com/SakibvHossain/Demo-Project-for-Spring-Security)
3

In Spring Boot version 3.2.0, I have seen that configuring Security (mainly related to CORS) in the Spring Boot application can lead to multiple calls (around 8 to 9 times) to the getResultFor(HttpServletRequest request) method of the HandlerMappingIntrospector class. Resulting in a Cache miss for REQUEST dispatch issue and impacting performance, as indicated in this Link.

Consider upgrading your Spring Boot version to 3.2.1 to address this issue.

After the upgrade, I observed that Spring no longer calls the mentioned method (based on my testing, though I cannot confirm at a high level).

1 Comment

I had this issue after upgrading to 3.2.0 from 2.7.5 according to specified ones. On first load the cache seems to be missed and it is redirecting with same queries when logged. And, clearly, cahce is enabled.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.