• 카테고리

    질문 & 답변
  • 세부 분야

    백엔드

  • 해결 여부

    해결됨

8:54 강의와 다른 오류가 발생했습니다!

24.03.11 22:42 작성 조회수 266

0

8분 54초 강의와 마찬가지로 MemberServiceIntegrationTest 테스트 케이스를 실행하였는데 강의와 다른 오류가 발생하였습니다!

 

오류 내용 - 중복_회원_예외()

java.lang.IllegalStateException: Failed to load ApplicationContext for [WebMergedContextConfiguration@709ed6f3 testClass = com.namu.namuspring.service.MemberServiceIntegrationTest, locations = [], classes = [com.namu.namuspring.NamuSpringApplication], 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@485966cc, org.springframework.boot.test.context.filter.ExcludeFilterContextCustomizer@7c711375, org.springframework.boot.test.json.DuplicateJsonObjectContextCustomizerFactory$DuplicateJsonObjectContextCustomizer@6e0f5f7f, org.springframework.boot.test.mock.mockito.MockitoContextCustomizer@0, org.springframework.boot.test.web.client.TestRestTemplateContextCustomizer@1e1a0406, org.springframework.boot.test.context.SpringBootTestAnnotation@793bd5d3], 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@709ed6f3 testClass = com.namu.namuspring.service.MemberServiceIntegrationTest, locations = [], classes = [com.namu.namuspring.NamuSpringApplication], 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@485966cc, org.springframework.boot.test.context.filter.ExcludeFilterContextCustomizer@7c711375, org.springframework.boot.test.json.DuplicateJsonObjectContextCustomizerFactory$DuplicateJsonObjectContextCustomizer@6e0f5f7f, org.springframework.boot.test.mock.mockito.MockitoContextCustomizer@0, org.springframework.boot.test.web.client.TestRestTemplateContextCustomizer@1e1a0406, org.springframework.boot.test.context.SpringBootTestAnnotation@793bd5d3], resourceBasePath = "src/main/webapp", contextLoader = org.springframework.boot.test.context.SpringBootContextLoader, parent = null]

 

 

답변 1

답변을 작성해보세요.

0

OMG님의 프로필

OMG

2024.03.11

안녕하세요. 김남욱님, 공식 서포터즈 OMG입니다.

화면 우측 상단의 코끼리모양 아이콘을 클릭하고 나서 다시 시도해보시겠어요?

image

동일한 문제가 발생하는 경우 아래 표시한 상위 테스트의 텍스트를 클릭한 오류 메시지 콘솔 내역을 복사하여 올려주시겠어요?

(현재 화면은 회원가입()을 클릭한 메시지만 확인됨)
image

감사합니다.

김남욱님의 프로필

김남욱

질문자

2024.03.12

https://drive.google.com/file/d/1tCGTwMtU3DewnN72QsrOch5DFP-6uthL/view?usp=sharing


 

제가 인텔리제이를 꺼버려서 아이콘이 사라져버렸네요 ㅠ...

부트도 지금 안켜겨가지고 코드 링크로 올리겠습니다!

 

============================

CONDITIONS EVALUATION REPORT

============================

Positive matches:

-----------------

None

Negative matches:

-----------------

None

Exclusions:

-----------

None

Unconditional classes:

----------------------

None

OMG님의 프로필

OMG

2024.03.13

강의를 수강하면서 h2 데이터베이스를 추가한 강좌를 학습하셨을거에요.

h2 데이터베이스를 사용한다면 스프링에도 관련된 설정을 적용하셔야 합니다.
강의 진행에 누락되거나, 강의와 다르게 작성한 부분을 짚어드릴테니 확인 후 수정하여 진행해주세요

 

(1) application.properties의 h2 설정 누락

imageimage

(2) SpringConfig 내 생성자 누락

강의코드

image

첨부해주신 코드

image

(3) SpringConfig 클래스의 위치(강의진행에 문제는 없습니다)

강의 코드 위치

image

첨부해주신 코드 위치

image

OMG님의 프로필

OMG

2024.03.13

차이점이 있는지 전반적으로 검토해주시고, MemoryMemberRepository를 사용하지 않고 Jdbc와 h2를 사용하는 시점부터는 h2가 실행중인 상태에서 강의 수강을 진행하셔야 합니다. 이부분도 참고하여주세요 😀

김남욱님의 프로필

김남욱

질문자

2024.03.13

해결 되었습니다! 감사합니다!