SpringSecurity 에서의 @EnableWebSecurity(debug = true) 에러

박민주·2024년 3월 1일
0

스프링시큐리티

목록 보기
3/6

spring security를 공부하던 중 디버깅 로그를 출력하기 위해 다음과 같이 설정하고 실행을 해보았다.

BackendApplication.java

@SpringBootApplication
@EnableWebSecurity(debug = true)
public class BackendApplication {

	public static void main(String[] args) {
		SpringApplication.run(EazyBankBackendApplication.class, args);
	}

}

application.yml

logging:
  level:
    org.springframework.security.web.FilterChainProxy : debug

하지만

Error creating bean with name 'springSecurityFilterChain': Failed to instantiate [org.springframework.security.config.annotation.web.configuration.WebMvcSecurityConfiguration$CompositeFilterChainProxy]: Constructor threw exception

에러가 발생하였다. 해결하기 위해 yml파일의 설정을 다시 확인해보기도 하고 그랬지만 별 효과가 없었고 SpringSecurity 깃헙페이지를 확인하게 되었다.

https://github.com/spring-projects/spring-security/issues/14370

깃헙페이지에서는 이 문제에 대해서 해결되었다고 하였지만 아직 릴리즈 되지않은 6.2.2버전에서 고쳤다는 것이었고, 이를 해결하기 위해서는 스프링부트의 버전을 낮추는 것으로 해결하였다.

<parent>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-parent</artifactId>
		<version>3.2.2</version>
		<relativePath/> <!-- lookup parent from repository -->
</parent>

기존 스프링 부트의 3.2.2 버전에서 3.1.5버전으로 낮추고 Reload 한 뒤 실행하자

디버깅 로그가 정상적으로 출력되는 것을 볼 수 있었다.

profile
개발자 되고싶다..

0개의 댓글