IllegalStateException
571
작성한 질문수 3
CoreApplicationTests를 run 했을 때 아래와 같은 에러가 발생합니다. 라이브 코딩으로 똑같이 따라했는데 왜 그러는걸까요? ㅠㅠ 구글 드라이브 링크 첨부합니다... 도와주세요 ㅠ
java.lang.IllegalStateException: Failed to load ApplicationContext for [MergedContextConfiguration@298d9a05 testClass = hello.core.CoreApplicationTests, locations = [], classes = [hello.core.CoreApplication], contextInitializerClasses = [], activeProfiles = [], propertySourceDescriptors = [], propertySourceProperties = ["org.springframework.boot.test.context.SpringBootTestContextBootstrapper=true"], contextCustomizers = [org.springframework.boot.test.autoconfigure.actuate.observability.ObservabilityContextCustomizerFactory$DisableObservabilityContextCustomizer@1f, org.springframework.boot.test.autoconfigure.properties.PropertyMappingContextCustomizer@0, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverContextCustomizer@4ef37659, org.springframework.boot.test.context.filter.ExcludeFilterContextCustomizer@306cf3ea, org.springframework.boot.test.json.DuplicateJsonObjectContextCustomizerFactory$DuplicateJsonObjectContextCustomizer@52102734, org.springframework.boot.test.mock.mockito.MockitoContextCustomizer@0, org.springframework.boot.test.web.client.TestRestTemplateContextCustomizer@4d910fd6, org.springframework.boot.test.context.SpringBootTestAnnotation@e50e93c5], contextLoader = org.springframework.boot.test.context.SpringBootContextLoader, parent = null]
구글 드라이브 링크 : https://drive.google.com/drive/folders/1KhcvynthGyhTtm1G1hGlFdkD7R1eHDBN?usp=sharing
답변 2
0
동일한 증상이 발생했는데 그냥 SpringBootTest어노테이션에 (classes = AutoAppConfig.class)달아서 해결했습니다....
0
안녕하세요. 김지원님, 공식 서포터즈 David입니다.
MemberServiceImpl에서 MemberRepository를 주입받아야 하는데, MemberRepository 주입 대상이 2개가 존재하여 발생한 문제입니다.
MemoryMemberRepository 클래스의 @Component를 제거하시거나 AutoAppConfig 클래스에서 MemberRepository를 생성하는 메서드를 제거하거나 @Primary 키워드를 사용해주세요.
ReteDiscountPolicy, DiscountPolicy를 사용하는 곳도 동일하게 변경해 주세요.
감사합니다.
fieldInjectionTest() 질문
0
58
1
AutoAppConfig의 존재이유
0
52
1
AppConfig와 스프링 빈 질문
0
57
1
[영한님]Spring Boot 및 프로젝트 생성
0
124
2
퀴즈가 안열려요
0
104
2
회원 도메인 인터페이스 개발
0
114
2
빈 스코프 개념의 중요성
0
95
1
SingletonService가 JVM이 뜰 때 생성되는게 맞나요?
0
152
2
섹션3. 11 회원객체 다이어그램
0
81
1
OCP, DIP과 @Qualifier 어노테이션에 대해서 질문합니다.
0
78
1
코드 자료
0
137
2
구현체가 동적으로 정해질 때, 팩토리 기법을 사용하나요?
0
134
2
MemberService의 인터페이스를 왜 사용하는지 궁금합니다.
0
148
1
롬복 @Setter를 써야 하는 상황이 있는건가요?
0
144
1
빈 등록 메서드의 파라미터가 빈이 아니어도 되나요?
0
139
1
테스트 속도가 나중에 영향이 있을까요?
0
128
1
gradle 설정 안떠서 질문 남깁니다!
0
266
2
build.gradle로 프로젝트를 여는 이유
0
162
1
provider 사용하는 이유
0
164
1
다음 강의 뭘 들어야 할까요
0
193
2
프로토타입 빈, 직접 destroy 호출 안 할 경우
0
114
1
beanB
0
135
2
퀴즈다시풀기
0
109
1
Gradle로 바꿔도 오류가 똑같이 발생하네요 ㅠㅠ
0
165
2





