Preparing Spring Security
The main change regarding security in Spring Boot 3 is the upgrading from Spring Security 5 to Spring Security 6. There are many changes related to this upgrade, but in the recipe, we’ll focus on the most common one, which is how it’s configured.
In Spring Security 5, most of the settings were configured by extending the WebSecurityConfigurerAdapter
class, and in Spring Security 6, those changes are applied by configuring specific beans in our application.
In this recipe, we’ll transform the WebSecurityConfigurerAdapter
class into a configuration class that exposes the beans to apply an equivalent configuration.
Getting ready
The starting point of this recipe is the outcome of the Preparing the application recipe. I prepared a working version in case you haven’t completed it yet. You can find it in the book’s GitHub repository at https://github.com/PacktPublishing/Spring-Boot-3.0-Cookbook in the chapter9/recipe9...