• 카테고리

    질문 & 답변
  • 세부 분야

    백엔드

  • 해결 여부

    미해결

mainDiscountPolicy 사용 시 StartApplicationTest에서 에러가 납니다

24.02.06 18:05 작성 조회수 143

0

[질문 템플릿]
1. 강의 내용과 관련된 질문인가요? 예
2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? 예
3. 질문 잘하기 메뉴얼을 읽어보셨나요? 예

[질문 내용]
여기에 질문 내용을 남겨주세요. mainDiscountPolicy를 만들고 test를 돌려봤는데 다음과 같은 에러가 납니다.StartApplicationTest를 제외하고는 다 통과합니다.잘 따라한 것 같은데 에러가 나서 질문드립니다. 어떻게 해결해야 할까요? java.lang.IllegalStateException: Failed to load ApplicationContext for [MergedContextConfiguration@15f2eda3 testClass = spring.demo.StartApplicationTests, locations = [], classes = [spring.demo.StartApplication], 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@27912e3, org.springframework.boot.test.context.filter.ExcludeFilterContextCustomizer@30b6ffe0, org.springframework.boot.test.json.DuplicateJsonObjectContextCustomizerFactory$DuplicateJsonObjectContextCustomizer@24c22fe, org.springframework.boot.test.mock.mockito.MockitoContextCustomizer@0, org.springframework.boot.test.web.client.TestRestTemplateContextCustomizer@72ade7e3, org.springframework.boot.test.context.SpringBootTestAnnotation@315e37a3], contextLoader = org.springframework.boot.test.context.SpringBootContextLoader, parent = null] 

답변 1

답변을 작성해보세요.

0

안녕하세요. 한지원님

다음을 참고해주세요.

https://docs.google.com/document/d/1j0jcJ9EoXMGzwAA2H0b9TOvRtpwlxI5Dtn3sRtuXQas/edit#heading=h.b1yk4ued1pxo

 

그래도 이슈가 해결되지 않으면

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

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

https://bit.ly/3fX6ygx

 

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

 

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

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

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

 

링크: 공식 서포터즈

링크: 자주하는 질문

감사합니다.

 

감사합니다.

한지원님의 프로필

한지원

질문자

2024.02.07

답변감사합니다.

확인해보니 @Component 가 fixDiscountPolicy가 아닌 rateDiscountPolicy에 있어 발생하는 문제였습니다. 고쳐서 바로 해결했습니다.