danDevlog

Caused by: org.springframework.beans.factory.BeanCreationExceptionf filterCains: Cannot resolve reference to bean ~security.web.defaultSecturityFilterChain 본문

오류 및 편의성 모음

Caused by: org.springframework.beans.factory.BeanCreationExceptionf filterCains: Cannot resolve reference to bean ~security.web.defaultSecturityFilterChain

단데기이 2022. 5. 8. 10:52
728x90

java.lang.IllegalStateException: Failed to load ApplicationContext
at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:132)

 

해당 오류는 Spring Security의 회원 생성 테스트 과정에서 생긴 오류이다.

 

	<security:authentication-manager> <!-- 인증 처리 관리자 -->
		<security:authentication-provider
			user-service-ref="customUserDetailService"> <!-- 인증처리 공급자 -->
			<security:password-encoder ref=""/>	
		</security:authentication-provider>
	</security:authentication-manager>

security-context.xml 파일에서  manager태그 부분에 

<security:password-encoder ref=""/> 이 부분에서 ref를 ""로 했던것이 오류의 원인이였다.

암호화방식을 지정해주지 않았기때문에 오류가난것이다.

 

	<security:authentication-manager> <!-- 인증 처리 관리자 -->
		<security:authentication-provider
			user-service-ref="customUserDetailService"> <!-- 인증처리 공급자 -->
			<security:password-encoder ref="bcryptPasswordEncoder"/>	
		</security:authentication-provider>
	</security:authentication-manager>

bcrypt 방식으로하겟다고 채워주면 오류없이 실행된다.

Comments