Error |
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'API2Controller': Unsatisfied dependency expressed through field 'studentRepository'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'studentRepository': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Failed to create query for method public abstract java.util.List com.wordata.test.repository.StudentRepository.findAllByOrdeByNameDesc()! No property ordeByNameDesc found for type Student!
에러 발생 상황 |
StudentReporsitory에서 method 이름에 오타가 남
에러 발생 이유 |
JpaRepository를 상속받은 StudentRepository interface에 method 이름에 오타가 나서
자동으로 구현된 클래스 내부에 정확한 이름의 method를 찾을 수 없음!
또한 이 경우 쿼리 메소드 이름 규칙을 지키지 못하게 된다.
Controller에서 정확한 이름의 method로 값을 가져올때 해당 method를 찾을 수 없다고 나온다.
해결 방법 |
오타 해결
No property ordeByNameDesc found for type Student! 부분을 잘 보면
orderBy 로 쓰여야 할 부분이 ordeBy 로 쓰인 것을 확인 할 수 있다.