[Springboot/Error] AuthenticationManager authenticationManagerBean() 메서드 해결

푸른별·2023년 6월 28일
0

Web

목록 보기
4/16

이전에 WebSecurityConfigurationAdapter 클래스를 상속받으니 deprecated되었다는 내용을 확인하였습니다. 그리고 오늘 회원정보에 대한 내용을 수정하는데, 특정 메서드를 override하여 만들어야 하는 Bean을 만들 수 없는 상황에 직면했습니다.

따라서 공식 문서에서도, 댓글에 제가 필요한 내용을 찾아 다음과 같이 문제를 해결하였습니다.

Deprecated Code

@Override
@Bean
public AuthenticationManager authenticationManagerBean() throws Exception{
	return super.authenticationManagerBean();
}

Latest Version Code

@Bean
    public AuthenticationManager authenticationManager(AuthenticationConfiguration authenticationConfiguration)
            throws Exception {
        return authenticationConfiguration.getAuthenticationManager();
    }

Reference: https://spring.io/blog/2022/02/21/spring-security-without-the-websecurityconfigureradapter

profile
묵묵히 꾸준하게

0개의 댓글