👉 nested exception is java.lang.IllegalStateException: Can't configure antMatchers after anyRequest
🧙 Solution
👉 .anyRequest().authenticated() to be used only once!
Please check if you used them once.
http
.httpBasic()
.and()
.authorizeRequests()
.antMatchers("/test/**").permitAll()
.and()
.authorizeRequests()
.antMatchers("/admin/**").hasAnyRole("ADMIN")
.anyRequest().authenticated()
.and()
.formLogin()
.permitAll();
👉 If that doesn't solve the problem??
Remove the .anyRequest() and .authenticated().
Then this problem will be solved.
Did my writing help you?
Please press the Thumb Up button
If you have any questions, please leave them in the comments