[문제해결] IllegalStateException: Failed to load ApplicationContext

Minseok Ku·2023년 1월 31일
0

문제해결

목록 보기
6/6

데이터 JPA를 공부하던 중 하나의 오류가 발생했다.

자세한 문제는 이러했다

Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'springConfig' defined in file [C:\javaStudy\springboot-study\hello-spring\out\production\classes\hello\hellospring\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.hellospring.repository.SpringDataJpaMemberRepository defined in @EnableJpaRepositories declared on JpaRepositoriesRegistrar.EnableJpaRepositoriesConfiguration: Invocation of init method failed; nested exception is org.springframework.data.repository.query.QueryCreationException: Could not create query for public abstract java.util.Optional hello.hellospring.repository.MemberRepository.findbyId(java.lang.Long); Reason: Failed to create query for method public abstract java.util.Optional hello.hellospring.repository.MemberRepository.findbyId(java.lang.Long)! No property 'findbyId' found for type 'Member'; nested exception is java.lang.IllegalArgumentException: Failed to create query for method public abstract java.util.Optional hello.hellospring.repository.MemberRepository.findbyId(java.lang.Long)! No property 'findbyId' found for type 'Member

이해 해 본 바..

JpaRepository 클래스를 상속받았는데. 인터페이스의 메소드 이름과 JpaRepository의 메소드 이름이 서로 달랐기 때문이었다.


JpaRepository 클래스


내가 구현했던 인터페이스

인터페이스의 메소드를 맞춰주면 해결!!

0개의 댓글