본문 바로가기
반응형

쿼리3

[ QueryDSL ] Could not find com.querydsl:querydsl-apt: 5.0.0. 오류 해결 방법 💥 Build 실행 후 발생한 에러 메시지itemservice-db:main: Could not find com.querydsl:querydsl-apt: 5.0.0.Required by:    project :Possible solution:- Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html ✅ 해결 방법공백을 제거해 줍니다.build.gradle// 수정 전//Querydsl 추가implementation 'com.querydsl:querydsl-jpa'annotationProcessor "com.quer.. 2024. 7. 22.
[Spring] 검색 요청 JPQL에서 QueryDSL로 변경하기 프로젝트를 진행 중 기존 검색 요청을 JQPL에서 QueryDSL로 변경하기로 하였다. 변경 이유에 대해서 간략하게 설명드리겠습니다. 아래에 변경 전 코드를 추가해 두었지만, JPA(JPQL)에서는 컴파일 시 N.P를 막지 못한다는 단점이 존재합니다. 그래서 필드의 Null처리를 위해서 서비스 코드의 코드 양 자체가 많아 진다는 단점이 존재합니다. 만약에 검색 조건이 2개에서 1개가 추가된다고 가정해 보면 필요한 JPQL의 최대 개수는 7개가 됩니다. 그렇게 되면 필요한 쿼리 메서드만 7개가 되어버리고 서비스 코드에 절대적으로 7줄이 추가될 수밖에 없습니다. QueyrDSL을 사용하게 되면 기존의 SOLID를 위배하지 않는 선에서 서비스 코드의 코드 양 자체를 줄일 수 있게 됩니다. 변경 전 코드 Sea.. 2024. 4. 15.
[ QueryDSL ] Parameter 0 of constructor in ArticleRepositoryCustomImpl required a bean of type 'java.lang.Class' that could not be found. 에러 해결 방법 💥 Application run 시 발생한 에러 메시지Description:Parameter 0 of constructor in com.example.demo.repository.querydsl.ArticleRepositoryCustomImpl required a bean of type 'java.lang.Class' that could not be found.Action:Consider defining a bean of type 'java.lang.Class' in your configuration. ❓에러 발생 이유Consider defining a bean of type 'java.lang.Class' in your configuration.라는 문구는 보통 Spring이 실행되면서 java 파일.. 2024. 4. 10.
반응형