Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- MySQL
- MySQL시작하기
- SQL
- NullPointerException
- Java
- K8S
- minikube
- VUE
- MYSQL에러
- Postman
- springMVC
- DB생성
- wappalyzer
- CloutNative
- restful api
- 이클립스
- String
- gradle
- offset
- Seek_Keyset
- appleM1
- frontend
- windows10
- SpringBoot
- 우분투에war배포
- Lombok
- spring
- intellij
- pagination
- 스프링에러
Archives
- Today
- Total
미운 오리 새끼의 우아한 개발자되기
[QueryDsl] querydsl 설정 본문
build.gradle 에서는 qEntity 가 생성되는 위치 설정 등이 필요하다.
plugins {
id 'org.springframework.boot' version '2.7.4'
id 'io.spring.dependency-management' version '1.0.14.RELEASE'
id 'java'
id 'com.ewerk.gradle.plugins.querydsl' version '1.0.10'
}
group = 'kr.co.hist'
version = '0.0.1-SNAPSHOT'
//sourceCompatibility = '17'
repositories {
mavenCentral()
}
dependencyManagement {
imports {
mavenBom('com.amazonaws:aws-xray-recorder-sdk-bom:2.8.0')
}
}
dependencies {
// https://mvnrepository.com/artifact/com.amazonaws/aws-java-sdk-core
implementation 'com.amazonaws:aws-java-sdk-core:1.12.329'
// https://mvnrepository.com/artifact/com.amazonaws/aws-java-sdk-cognitoidentity
implementation 'com.amazonaws:aws-java-sdk-cognitoidentity:1.12.328'
// https://mvnrepository.com/artifact/software.amazon.awssdk/cognitoidentityprovider
implementation 'software.amazon.awssdk:cognitoidentityprovider:2.18.4'
// https://mvnrepository.com/artifact/com.amazonaws/aws-java-sdk
implementation 'com.amazonaws:aws-java-sdk:1.12.329'
implementation group: 'io.jsonwebtoken', name: 'jjwt', version: '0.9.1'
// https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind
implementation 'com.fasterxml.jackson.core:jackson-databind:2.14.0-rc2'
// https://mvnrepository.com/artifact/org.postgresql/postgresql
implementation 'org.postgresql:postgresql:42.5.0'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa:2.7.4'
implementation 'org.springframework.boot:spring-boot-starter-data-jdbc'
implementation 'org.springframework.boot:spring-boot-starter-web'
// https://mvnrepository.com/artifact/org.springdoc/springdoc-openapi-ui
implementation 'org.springdoc:springdoc-openapi-ui:1.6.12'
// https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-data-redis
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-data-redis', version: '2.7.0'
// https://mvnrepository.com/artifact/com.querydsl/querydsl-apt
annotationProcessor 'com.querydsl:querydsl-apt:5.0.0'
// https://mvnrepository.com/artifact/com.querydsl/querydsl-jpa
implementation 'com.querydsl:querydsl-jpa:5.0.0'
compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.springframework.batch:spring-batch-test'
testImplementation 'org.springframework.security:spring-security-test'
}
test {
// useJUnitPlatform()
}
/* querydsl 에서 사용할 경로 지정*/
def querydslDir = 'src/main/generated'
/* JPA 사용 여부와 사용할 경로를 지정*/
querydsl {
jpa = true
querydslSourcesDir = querydslDir
}
/* build 시 사용할 SourceSet 추가 */
sourceSets {
main.java.srcDir querydslDir
}
/* querydsl 이 compileClasspath 를 상속하도록 설정 */
configurations {
compileOnly {
extendsFrom annotationProcessor
}
querydsl.extendsFrom compileClasspath
}
/* querydsl 컴파일시 사용할 옵션 설정 */
compileQuerydsl {
options.annotationProcessorPath = configurations.querydsl
}
compileQuerydsl.doFirst {
if(file(querydslDir).exists() )
delete(file(querydslDir))
}
config 파일은 아래와 같다.
package kr.co.hist.saladist.config;
import com.querydsl.jpa.impl.JPAQueryFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
@Configuration
public class QueryDslConfig {
@PersistenceContext
private EntityManager entityManager;
public QueryDslConfig() {}
@Bean
public JPAQueryFactory jpaQueryFactory() {
return new JPAQueryFactory(this.entityManager);
}
}
'Spring & Spring Boot > Spring Boot' 카테고리의 다른 글
[Spring Boot] Spring Security 에서 특정 URL만 제외하여 필터링하기 (0) | 2023.01.01 |
---|---|
[Spring Boot] Cloud Native Java - 애플리케이션 마이그레이션 (1) (0) | 2022.09.29 |
[Spring Boot] Cloud Native Java - Test(3) 스프링 클라우드 컨트랙트 (0) | 2022.09.29 |
[Spring Boot] Cloud Native Java - Test(2) 슬라이스 - @RestClientTest (0) | 2022.09.28 |
[Spring Boot] Cloud Native Java - Test(2) 슬라이스 - @DataJpaTest (0) | 2022.09.28 |