본문 바로가기

버그잡기

[Spring Framework] Failed to read candidate component class 에러 해결법

728x90
반응형

 

이클립스에서 스프링 프레임워크로 작업하던 중

 

setting.xml의 <context:component-scan base-package="..."/> 부분에서 에러가 나는 것을 확인하였습니다.

 

 

 

 

에러 로그는 Failed to read candidate component class 이였는데, BeanDefinitionStoreException 관련해서 에러가 발생하였습니다.

 

 

 

 

스프링 내에서 의존성 충돌 때문에 생기는 문제라고 하는데, 아래 글을 참고하여 해결하였습니다.

 

stackoverflow.com/questions/22771826/beandefinitionstoreexception-failed-to-read-candidate-component-class

 

BeanDefinitionStoreException Failed to read candidate component class

Can someone tell me how to solve this issue? I have narrowed down the problem to the pom.xml file. My project works but when I add the following dependency I get an error ...

stackoverflow.com

 

 

 

사이트 안의 글은 스프링 버전이 낮아서 생기는 문제였는데, 저의 경우는 5.x를 사용했으니 아마 버전이 오히려 높아서(?) 생기는 문제였던 것 같습니다.

 

 

 

 

pom.xml 에 다음의 버전으로 dependency를 걸어서 해결하였습니다.

 

<dependencies>
  	<dependency>
	  <groupId>org.springframework</groupId>
	  <artifactId>spring-context</artifactId>
	  <version>4.2.6.RELEASE</version>
	</dependency>
 </dependencies>

 

728x90
반응형