OliveLover / miniproject_hanhae66

0 stars 5 forks source link

UnsatisfiedDependencyException 오류 발생 (해결) #21

Open OliveLover opened 1 year ago

OliveLover commented 1 year ago

이슈 내용

UnsatisfiedDependencyException 오류 발생

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'commentController' defined in file [C:\Users\tikto\OneDrive\바탕 화면\miniproject_hanhae66\build\classes\java\main\com\sparta\hanghae66\controller\CommentController.class]: Unsatisfied dependency expressed through constructor parameter 0: Error creating bean with name 'commentService' defined in file [C:\Users\tikto\OneDrive\바탕 화면\miniproject_hanhae66\build\classes\java\main\com\sparta\hanghae66\service\CommentService.class]: Unsatisfied dependency expressed through constructor parameter 2: Error creating bean with name 'commentLikesRepository' defined in com.sparta.hanghae66.repository.CommentLikesRepository defined in @EnableJpaRepositories declared on JpaRepositoriesRegistrar.EnableJpaRepositoriesConfiguration: Could not create query for public abstract java.util.Optional com.sparta.hanghae66.repository.CommentLikesRepository.findByUsernameAndCommentId(java.lang.String,java.lang.Long); Reason: Failed to create query for method public abstract java.util.Optional com.sparta.hanghae66.repository.CommentLikesRepository.findByUsernameAndCommentId(java.lang.String,java.lang.Long); No property 'username' found for type 'CommentLikes' at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:800) ~[spring-beans-6.0.8.jar:6.0.8] at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:245) ~[spring-beans-6.0.8.jar:6.0.8]

스프링 빈 생성중 발생한 오류

해결 방법

리팩토링 과정에서 달라진 변수에 의한 Repository 쿼리가 맞지 않아 발생한 오류

likeservice에 관한 JPQL쿼리문을 달라진 변수로 바꾸거나 테스트를위해 해당부분 모두 주석

kanteluv commented 1 year ago

확인했습니다