jojoldu / freelec-springboot2-webservice

1.07k stars 461 forks source link

[오류] p.75 - hamcrest import 에러 #249

Closed chp320 closed 4 years ago

chp320 commented 4 years ago

기존에 올라온 질문이 아닌지 먼저 검색해주세요!

가장 자주 나온 제보

어떤 오류인가요?

오류설명:

  1. p.75에서 HelloControllerTest.java 파일에 API 테스트하는 코드 작성 시 import 에러가 발생합니다.
  2. import static org.hamcrest.Matcher.is ;
    위에서 is에 붉은색으로 표시되며 하단의 .andExpect(jsonPath("$.name", is(name))) 코드에서도 is에 붉게 표시되어 있으며,
  3. 혹시 라이브러리가 없나 해서 좌측 External Libraries에서 찾아보면 아래와 같이 존재합니다. Gradle: org.hamcrest:hamcrest-core:1.3 Gradle: org.hamcrest:hamcrest-library:1.3
  4. 혹시 몰라 에러로그는 README.md 에 이미지로 삽입했습니다..

프로젝트 주소

Github에 오류가 난 프로젝트를 올려주세요.
Github 주소를 작성해주지 않으시면 답변해드릴수가 없어요!

오류 로그

어떤 오류인지 캡쳐해주세요.

캡처1 캡처2

MinhoLee93 commented 4 years ago

@chp320

앗 오타가 있으시네요, 변경 후 잘 작동하는거 확인했습니다 :) Matcher에서 s가 빠져있네요 ㅎㅎ

기존 : import static org.hamcrest.Matcher.is; 변경 : import static org.hamcrest.Matchers.is;

chp320 commented 4 years ago

@MinhoLee93 확인 주셔서 정말 감사합니다... 오타가 맞네요.. ㅠㅠ 그런데 해당 오타 수정 후 HelloControllerTest 수행해보니 다른 곳에서 오류가 나네요.. ;; 로그를 보면, "PostsService" 가 호출되지 않는 것처럼 나오는데.. 특이사항은 없어보이는데.. 다른 사유가 있을까요?? T-T;;


APPLICATION FAILED TO START


Description:

Parameter 0 of constructor in com.skyfox83.study.springBoot.web.PostsApiController required a bean of type 'com.skyfox83.study.springBoot.service.posts.PostsService' that could not be found.

Action:

Consider defining a bean of type 'com.skyfox83.study.springBoot.service.posts.PostsService' in your configuration.

ghost commented 3 years ago

저도 같은 오타로 며칠;; 고생 중이었는데! ㅎㅎ 게시글 올려주셔서 감사합니다!