인프런 커뮤니티 질문&답변

최지웅님의 프로필 이미지

작성한 질문수

스프링 입문 - 코드로 배우는 스프링 부트, 웹 MVC, DB 접근 기술

스프링 데이터 JPA

UnsatisfiedDependencyException 에러

21.04.20 18:23 작성

·

14K

0

안녕하세요 김영한 강사님! 얼마 전부터 스프링을 재미있게 수강중인 취준생입니다.

스프링 데이터 JPA 예제를 따라 입력하고 회원가입과 중복회원 예외 테스트 코드를 실행하였더니, Error creating bean with name 'springConfig' defined in file [C:\SpringStudy\begin-spring\out\production\classes\hello\beginspring\SpringConfig.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'springDataJpaMemberRepository' defined in hello.beginspring.repository.SpringDataJpaMemberRepository defined in @EnableJpaRepositories declared on JpaRepositoriesRegistrar.EnableJpaRepositoriesConfiguration: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Failed to create query for method public abstract java.util.Optional hello.beginspring.repository.MemberRepository.findByID(java.lang.Long)! No property ID found for type Member! Did you mean 'id'?

위와 같은 에러가 발생하였는데, 검색으로 스스로 해결하지 못하였습니다.

SpringConfig.java

데이터 JPA가 빈을 등록할때 빈 자체를 인식하지 못하는것인지. 프로퍼티 id와 관련해서 오탈자가 있는 것인지 모르겠습니다.

어디를 보여드려야 할 지 몰라서 강의를 보며 입력한 코드의 깃허브 주소를 함께 올립니다.  

https://github.com/lilaco/begin-spring

퀄리티 높은 수업을 제공해 주셔서 감사합니다 :)

답변 1

1

김영한님의 프로필 이미지
김영한
지식공유자

2021. 04. 20. 21:37

안녕하세요. 지웅님

오류에 힌트가 있습니다^^

findByID -> findById로 변경해주셔야 합니다.

감사합니다.

최지웅님의 프로필 이미지
최지웅
질문자

2021. 04. 20. 23:26

오타를 못찾아서 헤맸네요ㅠㅠ 소중한 시간 써주셔서 감사합니다!