코딩기록
스프링부트 Parameter 2 of constructor in *** required a bean of type 'org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder' that could not be found. 해결 본문
백엔드/Spring Boot
스프링부트 Parameter 2 of constructor in *** required a bean of type 'org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder' that could not be found. 해결
빌럽스 2024. 10. 27. 22:15문제
스프링 프로젝트 시작 시 Parameter 2 of constructor in *** required a bean of type 'org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder' that could not be found. 에러가 발생했다.
해결
-> SecurityConfig 클래스에 @EnableWebSecurity 추가하면 된다.
@Configuration
@EnableWebSecurity
public class SecurityConfig {
@Bean
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
http
.csrf(AbstractHttpConfigurer::disable)
.sessionManagement(httpSecuritySessionManagementConfigurer ->
httpSecuritySessionManagementConfigurer
.sessionCreationPolicy(SessionCreationPolicy.STATELESS)
)
//
// .headers(headers ->
// headers.frameOptions(HeadersConfigurer.FrameOptionsConfig::sameOrigin)
// )
.formLogin(AbstractHttpConfigurer::disable)
.httpBasic(AbstractHttpConfigurer::disable);
return http.build();
}
}
'백엔드 > Spring Boot' 카테고리의 다른 글
서블릿과 서블릿 컨테이너 정리 (0) | 2024.10.29 |
---|---|
Facade Pattern이란? (0) | 2024.04.08 |
Java converter 사용 시 주의해야 할 점 - 회원가입 및 로그인 구현 관련 (1) | 2024.03.27 |
스프링 테스트 시 TestSuiteExecutionException: Could not execute test class 해결 방법 (0) | 2024.02.24 |