본문 바로가기

프로그래밍/ETC

[Spring] - 스프링 UnsatisfiedDependencyException

반응형

개요

프로젝트 진행중 git pull을 받은 후 Spring-boot를 re-run하는데

UnsatisfiedDependencyException 이 발생했다.

 

Error starting ApplicationContext.

To display the auto-configuration report re-run your application with 'debug' enabled.
[2020-03-19 17:08:06.408] [ERROR] [ main] [ SpringApplication] :

Application startup failed

org.springframework.beans.factory.UnsatisfiedDependencyException: 

Error creating bean with name 'commonApiController':

Unsatisfied dependency expressed through field 'projectService';

nested exception is 

org.springframework.beans.factory.UnsatisfiedDependencyException: 

Error creating bean with name 'projectService':

Unsatisfied dependency expressed through field 'userService';

nested exception is 

org.springframework.beans.factory.UnsatisfiedDependencyException: 

Error creating bean with name 'userService':

Unsatisfied dependency expressed through field 'uaaEndpoint';

nested exception is 

org.springframework.beans.factory.BeanCreationException: 

Error creating bean with name 'uaaEndpoint':

Injection of autowired dependencies failed;

nested exception is 

java.lang.IllegalArgumentException:

Could not resolve placeholder 'quota.item.iaas.compute.core' 

in value "${quota.item.iaas.compute.core}"
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:588)


해결


application-local2.propertiesquota.item.iaas.compute.core 값을 넣어줌

 

 


프로젝트의 구조상 DB정보를 .properties 파일에 정의해두고 있고

각각의 branch 별로 local property를 설정해놓는다.

(local1.properties, local2.properties)

 

그런데, 다른 분이 DB를 만들고 관련 정보를 local1.property에만 추가해 놓다 보니

local2.property를 바라보던 나의 경우엔 위와 같은 의존성 에러가 발생했던 것이다.

 

 

Reference


[Spring] 스프링 properties 사용시 UnsatisfiedDependencyException 발생 원인

반응형