π¬π§ Read in English: Quick Start: Spring Boot Web with Exposed
Kotlin Exposed μ μΈλΆ λ΄μ©μ 곡λΆνκΈ° μ μ κ°λ¨ν μμ λ₯Ό ν΅ν΄ Exposed λ₯Ό μ΄λ»κ² μ¬μ©ν μ μλμ§ μμλ΄ μλ€.
Kotlin Exposed λ μ체 transaction ν¨μ λΏ μλλΌ Spring Frameworkμ Transactionκ³Ό μμ°μ€λ½κ² ν΅ν©λ μ μλλ‘ @Transactional μ μ§μν©λλ€. μ΄λ₯Ό νμ©νλ©΄, μμ£Ό μ½κ² spring-data-jpa λ₯Ό μ¬μ©νλ κ²κ³Ό μ μ¬νκ² μ΄ν리μΌμ΄μ
μ μ μν μ μκ³ , λ μ’μ μ±λ₯μ κ°μΆ μ μμ΅λλ€.
νΉν Java 21 μ Virtual Threads λ₯Ό μ΄μ©νλ κ²½μ°μλ λ κ°μ§ λͺ¨λ μ¬μ©μ΄ κ°λ₯ν©λλ€.
μ΄ μμ μλ μνμ λ°°μ° μ 보λ₯Ό κ΄λ¦¬νλ μλΉμ€λ₯Ό μ μνλ €κ³ ν©λλ€. ERD λ₯Ό 보μλ©΄ μν μ 보λ₯Ό λνλ΄λ movies ν
μ΄λΈκ³Ό λ°°μ° μ 보λ₯Ό λνλ΄λ actors ν
μ΄λΈμ μ μνκ³ , μν μΆμ° κ΄κ³λ₯Ό λνλ΄λ actors_in_movies λΌλ many-to-many ννμ λ§€ν ν
μ΄λΈμ μ μν©λλ€.

μν, λ°°μ°μ μΆμ° λλ νλ‘λμ± κ΄κ³λ₯Ό λνλ΄λ ERD
μ΄λ² μμ λ spring-mvc-exposed λΌλ νλ‘μ νΈλ₯Ό κΈ°λ°μΌλ‘ μ€λͺ
ν©λλ€.
exposed-workshop/01-spring-boot/spring-mvc-exposed at main Β· bluetape4k/exposed-workshop
μμ νλ‘μ νΈλ λ€μκ³Ό κ°μ ꡬ쑰λ₯Ό κ°μ§λλ€. μΌλ°μ μΈ REST API μλΉμ€μ Spring MVC ꡬ쑰μ΄λ©°, μ΄λ² μμ μλ Java 21 μ Virtual Threads λ₯Ό μ§μν μ μλλ‘ ν©λλ€.

νλ‘μ νΈ κ΅¬μ‘°
μ΄ μμ λ λ€μκ³Ό κ°μ build.gradle.kts λ‘ μ°Έμ‘°λ₯Ό μ μν©λλ€.
plugins {
kotlin("plugin.spring")
id(Plugins.spring_boot)
id(Plugins.gatling) version Plugins.Versions.gatling // μ±λ₯ μΈ‘μ μ μννλ Gatling
}
springBoot {
mainClass.set("exposed.workshop.springmvc.SpringMvcApplicationKt")
buildInfo {
properties {
additional.put("name", "Spring MVC with Exposed")
additional.put("java.version", JavaVersion.current())
}
}
}
@Suppress("UnstableApiUsage")
configurations {
testImplementation.get().extendsFrom(compileOnly.get(), runtimeOnly.get())
}
dependencies {
testImplementation(project(":exposed-shared-tests"))
// bluetape4k
implementation(Libs.bluetape4k_io)
implementation(Libs.bluetape4k_jdbc)
testImplementation(Libs.bluetape4k_spring_tests)
// Exposed
implementation(Libs.bluetape4k_exposed)
implementation(Libs.exposed_core)
implementation(Libs.exposed_jdbc)
implementation(Libs.exposed_dao)
implementation(Libs.exposed_java_time)
implementation(Libs.exposed_spring_boot_starter)
// Database Drivers
implementation(Libs.hikaricp)
// H2
implementation(Libs.h2_v2)
// MySQL
implementation(Libs.bluetape4k_testcontainers)
implementation(Libs.testcontainers_mysql)
implementation(Libs.mysql_connector_j)
// PostgreSQL
implementation(Libs.bluetape4k_testcontainers)
implementation(Libs.testcontainers_postgresql)
implementation(Libs.postgresql_driver)
// Spring Boot
implementation(Libs.springBoot("autoconfigure"))
annotationProcessor(Libs.springBoot("autoconfigure-processor"))
annotationProcessor(Libs.springBoot("configuration-processor"))
runtimeOnly(Libs.springBoot("devtools"))
implementation(Libs.springBootStarter("web"))
implementation(Libs.springBootStarter("aop"))
implementation(Libs.springBootStarter("actuator"))
implementation(Libs.springBootStarter("validation"))
testImplementation(Libs.bluetape4k_spring_tests)
testImplementation(Libs.springBootStarter("test")) {
exclude(group = "junit", module = "junit")
exclude(group = "org.junit.vintage", module = "junit-vintage-engine")
exclude(module = "mockito-core")
}
// Others
}
build.gradle.kts μμ bluetape4k-exposed λΌλ μ κ° μ μν λΌμ΄λΈλ¬λ¦¬λ₯Ό μ¬μ©νλλ°, μ΄ λΆλΆμ bluetape4k μκ° λ° νμ© λ°©λ² μμ μμΈν μ€λͺ
νκ² μ΅λλ€.
μ΄ νλ‘μ νΈμμλ SQL DSL (Domain Specific Language) μ μ£Όλ‘ μ¬μ©ν μμ μ΄λΌ exposed-jdbc λͺ¨λμ μ£Όλ‘ μ¬μ© κ²μ΄κ³ , spring boot application μ λ§λ€κΈ° μν΄μ exposed-spring-boot-starter λͺ¨λμ νμλ‘ μ°Έμ‘°ν΄μΌ ν©λλ€.