728x90
java.lang.IllegalStateException: Failed to load ApplicationContext
...
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'springRunner': Injection of autowired dependencies failed; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'my.age' in value "${my.age}"
java.lang.IllegalStateException: Failed to load ApplicationContext
at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:132)
at org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:124)
at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:118)
at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:83)
//중략
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'springRunner': Injection of autowired dependencies failed; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'my.age' in value "${my.age}"
//중략
원인
: (test/resources/application.properties를 따로 정의하는 경우) src/main/resources/application.properties에 해당 키값을 정의해두고, test/resources/application.properties에는 정의하지 않는경우 해당 오류 발생
해결방법
: 두 application.properties에 동일하게 정의 혹은 test/resources/application.properties 삭제
728x90
'Spring Boot > error' 카테고리의 다른 글
The called method's class hierarchy was loaded from the following locations (0) | 2022.03.26 |
---|---|
HttpMediaTypeNotAcceptableException (0) | 2022.02.27 |
org.junit.runners.model.InvalidTestClassError (0) | 2022.02.05 |
댓글