추후에 정리하겠습니당.

Spring Security - How to Fix WebSecurityConfigurerAdapter Deprecated

SPRING Security - WebSecurityConfigurerAdapter deprecated 관련 이슈 및 권장방식 적용

HttpSecurity & WebSecurity

1) 기존의 방식

@Configuration
public class SecurityConfiguration extends WebSecurityConfigurerAdapter {

    @Override
    protected void configure(HttpSecurity http) throws Exception {
        http
            .authorizeHttpRequests((authz) -> authz
                .anyRequest().authenticated()
            )
            .httpBasic(withDefaults());
    }

		@Override
    public void configure(WebSecurity web) throws Exception {
				web.ignoring().antMatchers("/images/**", "/js/**", "/webjars/**");
    }
}

2) 변화된 방식

@Configuration
public class SecurityConfiguration {

    @Bean
    public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
        http
            .authorizeHttpRequests((authz) -> authz
                .anyRequest().authenticated()
            )
            .httpBasic(withDefaults());
        return http.build();
    }

		@Bean
    public WebSecurityCustomizer webSecurityCustomizer() {
        return (web) -> web.ignoring().antMatchers("/images/**", "/js/**", "/webjars/**");
    }
}