ARTICLE AD BOX
Updating SecurityConfig for Spring Boot 3
In Spring Boot 3 (Spring Security 6), the WebSecurityConfigurerAdapter is deprecated. You should now use a SecurityFilterChain bean like this:
@Bean public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { http .csrf(csrf -> csrf.disable()) .authorizeHttpRequests(auth -> auth .requestMatchers("/api/public/**").permitAll() .anyRequest().authenticated() ) .httpBasic(Customizer.withDefaults()); return http.build(); }