-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ JDBC & JPA & QueryDsl Configuration 설정 (#7)
* chore: mysql & jpa & queryDsl gradle 의존성 추가 * chore: queryDsl generated 디렉토리 git 추적 제거 * chore: jdbc, jpa application.yml 설정 추가 * chore: extenal-api 모듈 application.yml 그룹 추가 * chore: jpa 설정 profile 분리 && profile 그룹 추가 * chore: infra 모듈 application.yml 그룹 추가 * feat: Jpa config * feat: QueryDsl config * chore: EnalbeJpaAuditing auditorAwareRef 설정 제거 * fix: config 디렉토리 수정
- Loading branch information
1 parent
419521e
commit a27a3d9
Showing
8 changed files
with
121 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
pennyway-domain/src/main/java/kr/co/pennyway/DomainPackageLocation.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package kr.co.pennyway; | ||
|
||
public interface DomainPackageLocation { | ||
} |
14 changes: 14 additions & 0 deletions
14
pennyway-domain/src/main/java/kr/co/pennyway/config/JpaConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package kr.co.pennyway.config; | ||
|
||
import kr.co.pennyway.DomainPackageLocation; | ||
import org.springframework.boot.autoconfigure.domain.EntityScan; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.data.jpa.repository.config.EnableJpaAuditing; | ||
import org.springframework.data.jpa.repository.config.EnableJpaRepositories; | ||
|
||
@Configuration | ||
@EnableJpaAuditing | ||
@EntityScan(basePackageClasses = DomainPackageLocation.class) | ||
@EnableJpaRepositories(basePackageClasses = DomainPackageLocation.class) | ||
public class JpaConfig { | ||
} |
18 changes: 18 additions & 0 deletions
18
pennyway-domain/src/main/java/kr/co/pennyway/config/QueryDslConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package kr.co.pennyway.config; | ||
|
||
import com.querydsl.jpa.impl.JPAQueryFactory; | ||
import jakarta.persistence.EntityManager; | ||
import jakarta.persistence.PersistenceContext; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
|
||
@Configuration | ||
public class QueryDslConfig { | ||
@PersistenceContext | ||
private EntityManager entityManager; | ||
|
||
@Bean | ||
public JPAQueryFactory jpaQueryFactory() { | ||
return new JPAQueryFactory(entityManager); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,51 @@ | ||
spring: | ||
profiles: | ||
group: | ||
local: common | ||
prod: common | ||
|
||
datasource: | ||
url: ${DB_URL} | ||
username: ${DB_USER_NAME} | ||
password: ${DB_PASSWORD} | ||
driver-class-name: com.mysql.cj.jdbc.Driver | ||
|
||
--- | ||
spring: | ||
config: | ||
activate: | ||
on-profile: local | ||
|
||
jpa: | ||
database: MySQL | ||
open-in-view: false | ||
generate-ddl: false | ||
hibernate: | ||
ddl-auto: none | ||
show-sql: true | ||
properties: | ||
hibernate: | ||
dialect: org.hibernate.dialect.MySQLDialect | ||
|
||
logging: | ||
level: | ||
org.hibernate.sql: debug | ||
org.hibernate.type: trace | ||
com.zaxxer.hikari.HikariConfig: DEBUG | ||
|
||
--- | ||
spring: | ||
config: | ||
activate: | ||
on-profile: prod | ||
on-profile: prod | ||
|
||
jpa: | ||
database: MySQL | ||
open-in-view: false | ||
generate-ddl: false | ||
hibernate: | ||
ddl-auto: none | ||
show-sql: false | ||
properties: | ||
hibernate: | ||
dialect: org.hibernate.dialect.MySQLDialect |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
spring: | ||
profiles: | ||
group: | ||
local: common | ||
prod: common | ||
|
||
--- | ||
spring: | ||
config: | ||
|