-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: JPA Entity Persistence 모듈 분리
- Loading branch information
Showing
22 changed files
with
188 additions
and
211 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
### CUSTOM ### | ||
.vscode | ||
.DS_Store | ||
**/resources | ||
|
||
### DEFAULT ### | ||
HELP.md | ||
|
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,125 +1,50 @@ | ||
import org.jetbrains.kotlin.gradle.dsl.JvmTarget | ||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile | ||
import org.springframework.boot.gradle.tasks.bundling.BootJar | ||
|
||
val activeProfile = System.getenv("PROFILE") ?: "product" | ||
val imageTag = System.getenv("IMAGE_TAG") ?: "latest" | ||
val repoURL: String? = System.getenv("IMAGE_REPO_URL") | ||
|
||
plugins { | ||
id("org.springframework.boot") version "3.3.5" | ||
id("com.google.cloud.tools.jib") version "3.4.3" | ||
id("io.spring.dependency-management") version "1.1.6" | ||
|
||
id("io.freefair.lombok") version "8.10" | ||
kotlin("plugin.lombok") version "2.0.20" | ||
|
||
kotlin("jvm") version "2.0.21" | ||
kotlin("kapt") version "2.0.21" | ||
kotlin("plugin.spring") version "2.0.21" | ||
kotlin("plugin.jpa") version "2.0.21" | ||
kotlin("plugin.allopen") version "2.0.21" | ||
|
||
id("org.springframework.boot") version "3.3.5" | ||
id("io.spring.dependency-management") version "1.1.6" | ||
} | ||
|
||
allprojects { | ||
group = "kr.co.vacgom" | ||
version = "3.0.0" | ||
group = "kr.xd" | ||
version = "1.0.0" | ||
repositories { mavenCentral() } | ||
|
||
tasks.withType<KotlinCompile> { | ||
kotlinOptions { | ||
freeCompilerArgs += "-Xjsr305=strict" | ||
jvmTarget = "21" | ||
} | ||
} | ||
|
||
tasks.withType<Test> { | ||
useJUnitPlatform() | ||
} | ||
} | ||
|
||
java { | ||
sourceCompatibility = JavaVersion.VERSION_21 | ||
} | ||
|
||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
dependencies { | ||
val springBootVersion = "3.3.5" | ||
val jsonwebtokenVersion = "0.12.6" | ||
val javaJwtVersion = "4.4.0" | ||
|
||
implementation(platform("org.springframework.boot:spring-boot-dependencies:$springBootVersion")) | ||
annotationProcessor("org.springframework.boot:spring-boot-configuration-processor") | ||
implementation("org.springframework.boot:spring-boot-starter-web") | ||
implementation("org.springframework.boot:spring-boot-starter-data-jpa") | ||
implementation("org.springframework.boot:spring-boot-starter-security") | ||
implementation("org.springframework.boot:spring-boot-starter-actuator") | ||
implementation("org.springframework.boot:spring-boot-starter-validation") | ||
implementation("org.jetbrains.kotlin:kotlin-reflect") | ||
implementation("com.fasterxml.jackson.module:jackson-module-kotlin") | ||
implementation("io.jsonwebtoken:jjwt-api:$jsonwebtokenVersion") | ||
implementation("io.jsonwebtoken:jjwt-gson:$jsonwebtokenVersion") | ||
runtimeOnly("io.jsonwebtoken:jjwt-impl:$jsonwebtokenVersion") | ||
implementation("com.auth0:java-jwt:$javaJwtVersion") | ||
runtimeOnly("com.mysql:mysql-connector-j") | ||
testImplementation("org.springframework.boot:spring-boot-starter-test") | ||
testImplementation("org.springframework.security:spring-security-test") | ||
} | ||
|
||
jib { | ||
from { | ||
image = "amazoncorretto:21-alpine-jdk" | ||
} | ||
to { | ||
image = repoURL | ||
tags = setOf(imageTag) | ||
} | ||
container { | ||
jvmFlags = listOf( | ||
"-Dspring.profiles.active=$activeProfile", | ||
"-Dserver.port=8080", | ||
"-XX:+UseContainerSupport", | ||
"-Duser.timezone=Asia/Seoul" | ||
) | ||
ports = listOf("8080") | ||
} | ||
} | ||
|
||
subprojects { | ||
apply(plugin = "java") | ||
apply(plugin = "kotlin") | ||
apply(plugin = "kotlin-spring") | ||
apply(plugin = "org.springframework.boot") | ||
apply(plugin = "org.jetbrains.kotlin.jvm") | ||
apply(plugin = "io.spring.dependency-management") | ||
apply(plugin = "io.freefair.lombok") | ||
|
||
dependencies { | ||
implementation("org.jetbrains.kotlin:kotlin-reflect") | ||
implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.18.0") | ||
} | ||
|
||
repositories { mavenCentral() } | ||
tasks.withType<JavaCompile> { | ||
sourceCompatibility = "21" | ||
targetCompatibility = "21" | ||
} | ||
|
||
dependencies { | ||
val springBootVersion = "3.3.5" | ||
val jsonwebtokenVersion = "0.12.6" | ||
val javaJwtVersion = "4.4.0" | ||
tasks.withType<KotlinCompile> { | ||
compilerOptions { | ||
jvmTarget.set(JvmTarget.JVM_21) | ||
} | ||
} | ||
|
||
implementation(platform("org.springframework.boot:spring-boot-dependencies:$springBootVersion")) | ||
implementation("org.springframework.boot:spring-boot-starter-web") | ||
implementation("org.springframework.boot:spring-boot-starter-data-jpa") | ||
implementation("org.springframework.boot:spring-boot-starter-security") | ||
implementation("org.springframework.boot:spring-boot-starter-actuator") | ||
implementation("org.springframework.boot:spring-boot-starter-validation") | ||
implementation("org.jetbrains.kotlin:kotlin-reflect") | ||
implementation("com.fasterxml.jackson.module:jackson-module-kotlin") | ||
implementation("io.jsonwebtoken:jjwt-api:$jsonwebtokenVersion") | ||
implementation("io.jsonwebtoken:jjwt-gson:$jsonwebtokenVersion") | ||
runtimeOnly("io.jsonwebtoken:jjwt-impl:$jsonwebtokenVersion") | ||
implementation("com.auth0:java-jwt:$javaJwtVersion") | ||
runtimeOnly("com.mysql:mysql-connector-j") | ||
testImplementation("org.springframework.boot:spring-boot-starter-test") | ||
testImplementation("org.springframework.security:spring-security-test") | ||
annotationProcessor("org.springframework.boot:spring-boot-configuration-processor") | ||
tasks.withType<Test> { | ||
useJUnitPlatform() | ||
} | ||
|
||
java { | ||
sourceCompatibility = JavaVersion.VERSION_21 | ||
tasks.withType<BootJar> { | ||
enabled = false | ||
} | ||
} |
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,29 @@ | ||
plugins { | ||
kotlin("jvm") | ||
kotlin("plugin.spring") | ||
id("org.springframework.boot") | ||
id("io.freefair.lombok") version "8.10" | ||
} | ||
|
||
dependencies { | ||
val springBootVersion = "3.3.5" | ||
val jsonwebtokenVersion = "0.12.6" | ||
val javaJwtVersion = "4.4.0" | ||
|
||
implementation(project(":vacgom-persistence")) | ||
// implementation("org.springframework.boot:spring-boot-starter-data-jpa") | ||
implementation(platform("org.springframework.boot:spring-boot-dependencies:$springBootVersion")) | ||
implementation("org.springframework.boot:spring-boot-starter-web") | ||
implementation("org.springframework.boot:spring-boot-starter-security") | ||
implementation("org.springframework.boot:spring-boot-starter-actuator") | ||
implementation("org.springframework.boot:spring-boot-starter-validation") | ||
implementation("org.jetbrains.kotlin:kotlin-reflect") | ||
implementation("com.fasterxml.jackson.module:jackson-module-kotlin") | ||
implementation("io.jsonwebtoken:jjwt-api:$jsonwebtokenVersion") | ||
implementation("io.jsonwebtoken:jjwt-gson:$jsonwebtokenVersion") | ||
runtimeOnly("io.jsonwebtoken:jjwt-impl:$jsonwebtokenVersion") | ||
implementation("com.auth0:java-jwt:$javaJwtVersion") | ||
|
||
testImplementation("org.springframework.boot:spring-boot-starter-test") | ||
testImplementation("org.springframework.security:spring-security-test") | ||
} |
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
8 changes: 0 additions & 8 deletions
8
vacgom-api/src/main/kotlin/kr/co/vacgom/api/global/config/AuditingConfig.kt
This file was deleted.
Oops, something went wrong.
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
11 changes: 11 additions & 0 deletions
11
vacgom-persistence/src/main/java/kr/co/vacgom/persistence/global/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,11 @@ | ||
package kr.co.vacgom.persistence.global.config; | ||
|
||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.data.jpa.repository.config.EnableJpaAuditing; | ||
import org.springframework.data.jpa.repository.config.EnableJpaRepositories; | ||
|
||
@Configuration | ||
@EnableJpaAuditing | ||
@EnableJpaRepositories(basePackages = "kr.co.vacgom.persistence") | ||
public class JpaConfig { | ||
} |
42 changes: 42 additions & 0 deletions
42
...rc/main/java/kr/co/vacgom/persistence/global/config/SnakeCaseUpperCaseNamingStrategy.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,42 @@ | ||
package kr.co.vacgom.persistence.global.config; | ||
|
||
import org.hibernate.boot.model.naming.Identifier; | ||
import org.hibernate.boot.model.naming.PhysicalNamingStrategy; | ||
import org.hibernate.engine.jdbc.env.spi.JdbcEnvironment; | ||
import org.springframework.context.annotation.Configuration; | ||
|
||
@Configuration | ||
public class SnakeCaseUpperCaseNamingStrategy implements PhysicalNamingStrategy { | ||
|
||
|
||
private String convertToSnakeCaseUpperCase(String input) { | ||
String regex = "([a-z])([A-Z]+)"; | ||
String replacement = "$1_$2"; | ||
return input.replaceAll(regex, replacement).toUpperCase(); | ||
} | ||
|
||
@Override | ||
public Identifier toPhysicalCatalogName(Identifier identifier, JdbcEnvironment jdbcEnvironment) { | ||
return null; | ||
} | ||
|
||
@Override | ||
public Identifier toPhysicalSchemaName(Identifier identifier, JdbcEnvironment jdbcEnvironment) { | ||
return null; | ||
} | ||
|
||
@Override | ||
public Identifier toPhysicalTableName(Identifier name, JdbcEnvironment context) { | ||
return new Identifier(convertToSnakeCaseUpperCase(name.getText()), name.isQuoted()); | ||
} | ||
|
||
@Override | ||
public Identifier toPhysicalSequenceName(Identifier identifier, JdbcEnvironment jdbcEnvironment) { | ||
return null; | ||
} | ||
|
||
@Override | ||
public Identifier toPhysicalColumnName(Identifier name, JdbcEnvironment context) { | ||
return new Identifier(convertToSnakeCaseUpperCase(name.getText()), name.isQuoted()); | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...vacgom/persistence/global/BaseEntity.java → ...persistence/global/entity/BaseEntity.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
6 changes: 3 additions & 3 deletions
6
...vacgom/persistence/hospital/Hospital.java → ...persistence/hospital/entity/Hospital.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
Oops, something went wrong.