๋ฐ์ํ
QueryDSL gradle ์ค์
plugins {
id 'java'
id 'org.springframework.boot' version '3.0.6'
id 'io.spring.dependency-management' version '1.1.0'
// id "com.ewerk.gradle.plugins.querydsl" version "1.0.10"
}
group = 'dev.be'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '17'
configurations {
compileOnly {
extendsFrom annotationProcessor
}
}
repositories {
mavenCentral()
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation('org.springframework.boot:spring-boot-starter-data-jpa')
implementation('org.springframework.boot:spring-boot-starter-data-rest')
implementation('mysql:mysql-connector-java:8.0.32')
compileOnly 'org.projectlombok:lombok'
developmentOnly 'org.springframework.boot:spring-boot-devtools'
runtimeOnly 'com.h2database:h2'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testCompileOnly('org.projectlombok:lombok')
testAnnotationProcessor('org.projectlombok:lombok')
// === QueryDsl ์์ ===
implementation 'com.querydsl:querydsl-jpa:5.0.0:jakarta'
annotationProcessor "com.querydsl:querydsl-apt:5.0.0:jakarta"
annotationProcessor "jakarta.annotation:jakarta.annotation-api"
annotationProcessor "jakarta.persistence:jakarta.persistence-api"
}
tasks.named('test') {
useJUnitPlatform()
}
// === Querydsl ๋น๋ ์ต์
(์ ํ์ฌํญ) ===
def querydslDir = "$buildDir/generated/querydsl"
sourceSets {
main.java.srcDirs += [ querydslDir ]
}
tasks.withType(JavaCompile) {
options.annotationProcessorGeneratedSourcesDirectory = file(querydslDir)
}
clean.doLast {
file(querydslDir).deleteDir()
}
๐ก JPA ๊ธฐ๋ณธ ๊ฒ์ ๊ธฐ๋ฅ ๊ตฌํํ๊ธฐ
QuerydslPredicateExecutor
๊ธฐ๋ณธ ๊ฒ์ ๊ธฐ๋ฅ์ ์ ํด๋์ค๋ฅผ ์์๋ฐ์์ผ๋ก์จ ๊ตฌํ ๊ฐ๋ฅํ๋ค.
@RepositoryRestResource
public interface ArticleRepository extends
JpaRepository<Article, Long>,
QuerydslPredicateExecutor<Article>
{}
์ด๋ ๊ฒ ๋ค์ ์ํฐํฐ๋ฅผ ์ ์ด์ฃผ๋๋ฐ, ์ด ์ํฐํฐ ์์ ์๋ ๋ชจ๋ ํ๋์ ๋ํ ๊ธฐ๋ณธ ๊ฒ์ ๊ธฐ๋ฅ์ ์ถ๊ฐํด์ค๋ค.
์ด ๋, ๊ธฐ๋ณธ ๊ฒ์ ๊ธฐ๋ฅ์ ๋์๋ฌธ์๋ฅผ ๊ตฌ๋ถํ์ง ์๊ณ , ์ ์ฒด ์
๋ ฅ๊ฐ ๊ฒ์(๋ถ๋ถ ๊ฒ์์ด ๋์ง ์์์ ์๋ฏธ) ์ ์๋ฏธํ๋ค.
HAL Explorer
๋ก ํ
์คํธ
728x90
๋ฐ์ํ
'์คํ๋ง > ๊ฒ์ํ ๋ง๋ค๊ธฐ' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
Spring Security - CSRF(Cross-Site Request Forgery) (0) | 2023.01.23 |
---|---|
JPA - OSIV (Open Session In View) (0) | 2023.01.22 |
๊ฒ์ํ ํ์ด์ง ๋ง๋ค๊ธฐ (0) | 2023.01.18 |
๋ฐ์ดํฐ ๋ฒ ์ด์ค ์ ๊ทผ ๋ก์ง (0) | 2023.01.18 |
๋๋ฉ์ธ ์ค๊ณ (0) | 2023.01.18 |