-demo(root)
	- presentation
    - domain
    - external
rootProject.name = "demo"
include("external")
include("presentation")
include("domain")
/domain
	/src
    	/main
        	/kotlin
            	/domain
                	/annotation
                    /auth
                    /common
                    /employee
            /resources
            	/mapper
                	employeeMapper.xml
                mybatis-config.xml
        /test
        build.gradle.kts
import org.springframework.boot.gradle.tasks.bundling.BootJar
plugins {
    id("org.springframework.boot") version "3.3.2"
    id("io.spring.dependency-management") version "1.1.6"
    kotlin("jvm") version "2.0.10"
    kotlin("plugin.spring") version "2.0.10"
}
group = "com.example"
version = "0.0.1-SNAPSHOT"
repositories {
    mavenCentral()
}
dependencies {
    implementation("org.springframework.boot:spring-boot-starter-web") {
        exclude("org.springframework.boot:spring-boot-starter-tomcat")
    }
    testImplementation(platform("org.junit:junit-bom:5.10.0"))
    testImplementation("org.junit.jupiter:junit-jupiter")
}
tasks.test {
    useJUnitPlatform()
}
val jar: Jar by tasks
val bootJar: BootJar by tasks
bootJar.enabled = false - plain.jar만 생성된다
jar.enabled = true
@ConfigurationPropertiesScan(basePackages = ["demo", "domain"])
@SpringBootApplication(scanBasePackages = ["demo", "domain"])
@MapperScan(basePackages = ["domain.auth.repository.mapper", "domain.employee.repository.mapper"])
class DemoApplication
fun main(args: Array<String>) {
	runApplication<DemoApplication>(*args)
}
이때 유의할 점은 mybatis의 @Mapper 애노테이션을 정상적으로 스캔하기 위해 @MapperScan을 사용해야 한다는 점이다. 또한 basePackage를 명시할 때 최상위 패키지가 아닌 해당 Mapper 클래스가 존재하는 패키지를 구체적으로 명시해줘야 한다.
gradle은 아래와 같이 설정한다
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
    id("org.springframework.boot") version "3.3.2"
    id("io.spring.dependency-management") version "1.1.6"
    kotlin("jvm") version "2.0.10"
    kotlin("plugin.spring") version "2.0.10"
}
group = "com.example"
version = "0.0.1-SNAPSHOT"
repositories {
    mavenCentral()
}
dependencyManagement {
    imports {
        mavenBom("io.github.resilience4j:resilience4j-bom:2.1.0")
    }
}
configurations {
    compileOnly {
        extendsFrom(configurations.annotationProcessor.get())
    }
}
val jwtVersion by extra { "0.11.5" }
dependencies {
    implementation("org.springframework.boot:spring-boot-starter-web")
    implementation(project(":domain")) -- 도메인 모듈에 대한 의존성을 추가한다
    testImplementation(platform("org.junit:junit-bom:5.10.0"))
    testImplementation("org.junit.jupiter:junit-jupiter")
    testImplementation("org.mybatis.spring.boot:mybatis-spring-boot-starter-test:3.0.3")
    implementation("org.mybatis.spring.boot:mybatis-spring-boot-starter:3.0.3")
    implementation("org.springframework.boot:spring-boot-starter-actuator")
    implementation("org.springframework.boot:spring-boot-starter-aop")
    implementation("io.jsonwebtoken:jjwt-api:$jwtVersion")
}
tasks.withType<KotlinCompile> {
    kotlinOptions {
        freeCompilerArgs += "-Xjsr305=strict"
        jvmTarget = "17"
    }
}
dependencyManagement {
    imports {
        mavenBom("io.github.resilience4j:resilience4j-bom:2.1.0")
    }
}