| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | |||
| 5 | 6 | 7 | 8 | 9 | 10 | 11 |
| 12 | 13 | 14 | 15 | 16 | 17 | 18 |
| 19 | 20 | 21 | 22 | 23 | 24 | 25 |
| 26 | 27 | 28 | 29 | 30 | 31 |
Tags
- Java
- spring
- 프로그래머스
- restTemplate
- ORM
- 개발자
- QueryDSL
- 핵심가이드
- 백엔드공부
- 백준
- error
- spring boot
- JWT
- LinkedList
- queue
- TestCode
- 자료구조
- 스프링부트
- 백엔드
- 연관관계
- SpringSecurity
- SpringBoot
- JPA
- 컴퓨터 공학
- array
- 제로베이스
- 서버
- 컴퓨터 구조
- 백엔드스쿨
- actuator
Archives
- Today
- Total
be_better
[Springboot] QueryDSL 설정 gradle 본문
목차
build.gradle 수정
코드 맨 위 queryDslVersion 추가
buildscript {
ext {
queryDslVersion = "5.0.0"
}
}
plugin 추가
plugins {
id 'java'
id 'org.springframework.boot' version '2.7.17'
id 'io.spring.dependency-management' version '1.0.15.RELEASE'
// querydsl 플러그인 추가
id "com.ewerk.gradle.plugins.querydsl" version "1.0.10"
}
configurations 확인
configurations {
compileOnly {
extendsFrom annotationProcessor
}
}
dependencies 추가
dependencies {
// queryDSL 설정
implementation "com.querydsl:querydsl-jpa:${queryDslVersion}"
implementation "com.querydsl:querydsl-apt:${queryDslVersion}"
}
제일 아래 줄에 QueryDSL 설정 추가
//querydsl 추가 시작
def querydslDir = "$buildDir/generated/querydsl"
querydsl {
jpa = true
querydslSourcesDir = querydslDir
}
sourceSets {
main.java.srcDir querydslDir
}
compileQuerydsl{
options.annotationProcessorPath = configurations.querydsl
}
configurations {
compileOnly {
extendsFrom annotationProcessor
}
querydsl.extendsFrom compileClasspath
}
//querydsl 추가 끝
Preferences 설정
[Settings] - [Build, Execution, Deployment] - [Compiler] - [Annotation Processors] 에서
Enable annotation processing 체크박스 체크

gradle 수정이 끝났다면 build한다음 오른쪽 gradle 탭에서 compileQuerydsl을 실행하면
build/generated/querydsl 안에 Qdomain 클래스가 생성된 것을 확인할 수 있다.


'Springboot > 이론' 카테고리의 다른 글
| [Springboot] 연관관계 매핑 - 종류, 일대일 매핑 (0) | 2023.11.17 |
|---|---|
| [Springboot] Spring Data JPA 활용 - JPA Auditing (0) | 2023.11.12 |
| [Springboot] Spring Data JPA 활용 - @Query 어노테이션 (0) | 2023.11.10 |
| [Springboot] Spring Data JPA 활용 - 정렬과 페이징 (0) | 2023.11.10 |
| [Springboot] Spring Data JPA 활용 - JPQL (0) | 2023.11.10 |