Lab: Major Release Considerations ‐ 6: Handle Changed EnableWebSecurity annotation - shinyay/spring-boot-2-7-to-3-1-upgrade GitHub Wiki
6: Handle Changed EnableWebSecurity annotation Wait, I bet you thought you were done!
In Spring Security 6.0, the Spring Security maintainers decided to remove the @Configuration annotation from @EnableWebSecurity.
Now is a good time to make sure your security configuration gets picked up when you migrate to Spring Boot 3.1.x.
Add the @Configuration annotation.
Update SecurityConfig and add the @Configuration before the @EnableWebSecurity annotation.
@EnableWebSecurity @Configuration // <== Add this @EnableWebSecurity public class SecurityConfig { ... } Don't forget to add corresponding import:
import org.springframework.context.annotation.Configuration; Update our notes.
Add the following to the Major Release Considerations section of the upgrade-notes.md file:
- Add
@Configuration
annotation, which is removed in Spring Security 6.0 Before we're done, let's establish a new baseline.