inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

실전! 스프링 부트와 JPA 활용1 - 웹 애플리케이션 개발

회원 기능 테스트

테스트 오류 질문

1284

작성자 없음

작성한 질문수 0

0

ApplicationContext failure threshold (1) exceeded: skipping repeated attempt to load context for [WebMergedContextConfiguration@33a71d23 testClass = jpabook.jpashop.service.MemberServiceTest, locations = [], classes = [jpabook.jpashop.JpashopApplication], 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@55dfcc6, org.springframework.boot.test.context.filter.ExcludeFilterContextCustomizer@25bfcafd, org.springframework.boot.test.json.DuplicateJsonObjectContextCustomizerFactory$DuplicateJsonObjectContextCustomizer@eda25e5, org.springframework.boot.test.mock.mockito.MockitoContextCustomizer@0, org.springframework.boot.test.web.client.TestRestTemplateContextCustomizer@2d96543c, org.springframework.boot.test.context.SpringBootTestAnnotation@8b5a38a4], resourceBasePath = "src/main/webapp", contextLoader = org.springframework.boot.test.context.SpringBootContextLoader, parent = null]

java.lang.IllegalStateException: ApplicationContext failure threshold (1) exceeded: skipping repeated attempt to load context for [WebMergedContextConfiguration@33a71d23 testClass = jpabook.jpashop.service.MemberServiceTest, locations = [], classes = [jpabook.jpashop.JpashopApplication], 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@55dfcc6, org.springframework.boot.test.context.filter.ExcludeFilterContextCustomizer@25bfcafd, org.springframework.boot.test.json.DuplicateJsonObjectContextCustomizerFactory$DuplicateJsonObjectContextCustomizer@eda25e5, org.springframework.boot.test.mock.mockito.MockitoContextCustomizer@0, org.springframework.boot.test.web.client.TestRestTemplateContextCustomizer@2d96543c, org.springframework.boot.test.context.SpringBootTestAnnotation@8b5a38a4], resourceBasePath = "src/main/webapp", contextLoader = org.springframework.boot.test.context.SpringBootContextLoader, parent = null]

at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:145)

at org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:130)

at org.springframework.test.context.web.ServletTestExecutionListener.setUpRequestContextIfNecessary(ServletTestExecutionListener.java:191)

at org.springframework.test.context.web.ServletTestExecutionListener.prepareTestInstance(ServletTestExecutionListener.java:130)

at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:260)

at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:228)

at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:289)

at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:291)

at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:247)

at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:97)

at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)

at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)

at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:191)

계속 오류나서 Memberservice MemberRepository 랑 test 다 코드 복붙했는데도 오류요

java spring 웹앱 spring-boot jpa

답변 2

0

David

안녕하세요. tjdwlsdn2020님, 공식 서포터즈 David입니다.

도움을 드리고 싶지만 질문 내용만으로는 답변을 드리기 어렵습니다.

실제 동작하는 전체 프로젝트를 ZIP파일로 압축해서 구글 드라이브로 공유해서 링크를 남겨주세요.

구글 드라이브 업로드 방법은 다음을 참고해주세요.

https://bit.ly/3fX6ygx


주의: 업로드시 링크에 있는 권한 문제 꼭 확인해주세요


추가로 다음 내용도 코멘트 부탁드립니다.

1. 문제 영역을 실행할 수 있는 방법

2. 문제가 어떻게 나타나는지에 대한 상세한 설명


링크: 공식 서포터즈

링크: 자주하는 질문

감사합니다.


0

tjdwlsdn2020

https://drive.google.com/file/d/1jEOFgnIZ2fRBWTDKmYaA3lnrid-0i10E/view?usp=drive_link
구글 드라이브에 프로젝트 전체 압축했습니다.

0

인프런 AI 인턴

안녕하세요, 인프런 AI 인턴입니다.

tjdwlsdn2020님, 제공해 주신 오류 내용을 통해 확인해보니, ApplicationContext의 로드에 실패하여 테스트 환경 구성 중에 문제가 발생한 것으로 보입니다. 이와 유사한 문제로 질문하신 다른 학습자 분의 경우를 살펴볼 때, 일반적으로 이런 문제는 설정 파일의 오류, 스프링 부트 버전의 충돌, 의존성 문제, 테스트 환경 설정의 오류 등 다양한 원인으로 발생할 수 있습니다.

특히, Failed to load ApplicationContext 오류가 발생하는 경우는 스프링 부트 애플리케이션의 컨텍스트 설정에 문제가 있을 때 발생하는 것으로, 테스트 케이스 설정이 올바르지 않거나, 설정 파일에 문제가 있는 경우 자주 보게됩니다. 이러한 종류의 문제를 해결하기 위해서는, 다음과 같은 절차를 따라 문제를 점검해볼 수 있습니다:

  1. application.properties 또는 application.yml 설정 파일이 올바르게 구성되어 있는지 확인해 보세요.
  2. 스프링 부트 및 기타 의존성들의 버전이 프로젝트의 요구사항을 만족하는지 검토해 보세요.
  3. 테스트 클래스가 올바른 위치에 있고, @SpringBootTest 어노테이션을 포함하고 있는지 확인해 보세요.
  4. 테스트 클래스와 관련된 구성 클래스(@Configuration이 적용된 클래스)에 문제가 없는지 점검해 보세요.

이와 더불어, 제공된 상황과 유사한 문제에 대해 논의된 답변 링크를 참조하는 것이 도움이 될 수 있습니다:

이 링크에서는 Failed to load ApplicationContext 오류와 유사한 문제를 다루고 있으며, 해당 문제의 해결 방법에 대한 좋은 정보를 얻을 수 있습니다.

저는 질문자님의 이해를 돕고자 지식공유자님의 기존 답변을 참고하여 유사한 답변 링크를 추천해드리고 있습니다.

현재 베타 기능으로 답변이 만족스럽지 않을 수 있는 점 양해 부탁드립니다. 🙏

추가적으로 궁금한 점이 있으시면, 이어서 질문해 주세요. 곧 지식공유자께서 답변해 주실 것입니다.

0

tjdwlsdn2020

yml도 그대로 복붙했고 다 복붙해서 다시 돌려봐도 안되네요

OrderServiceTest 상문주문 테스트 시 update 쿼리 문의

0

27

1

sdk 설정 오류

0

68

2

오탈자 - @Transactional

0

62

1

src/test/resources 테스트 경로 문제

0

57

1

상품 등록후 H2 db 출력 순서 바꿀 수 있나요?

0

70

1

MemberRepositoryTest 실행오류

0

90

1

boot 4.x >>> trasasction rolled back log & p6spy(영한님, 수업 자료 업데이트 해주시면 감사하겠습니다!!)

1

195

2

강의 마지막 QueryDSL 사용 부분 질문있습니다

1

153

2

클라이언트에서 isbn과 author 수정 요청을 한 경우에 대해 질문드립니다.

0

56

1

도메인 모델 패턴 vs 트랜잭션 스크립트 패턴

0

80

1

기본 생성자

0

67

1

h2 DB 연결시 jdbc url 변경 이유가 궁금합니다.

0

107

1

멤버서비스테스트 부분에서 막힙니다.

0

174

4

실무에서도 EntityManager를 이용해서 많이 작업하는 편일까요?

0

124

1

초반에 h2 다운로드 과정 꼭 필요한가요?

0

129

2

자신 필드에도 get으로 접근하는 이유가 있을까요?

0

121

1

24분 27초 연관관계 편의 메서드 위치

0

118

1

단건 주문만 가능하게 한건 의도한 부분이신가요?

0

114

2

빌드 툴, Gradle

0

63

1

h2연결은 된 것 같은데 엔티티 테이블까지 작성 후 확인해보아도 테이블이 안보입니다

0

81

2

Repository에서 EntityManager 주입 방식 차이

0

97

1

롬복과 사용자 정의 setter 메서드

0

77

1

주문 목록 조회 fetch join 질문드립니다

0

91

1

dirty checking 질문드립니다.

0

87

1