[#17] feat: 멀티 모듈 구성

- Repository common 영역으로 공통화
- gradle 설정 수정
- main class 이름 변경
- java -> kotlin 디렉토리명 변경
This commit is contained in:
beaniejoy
2022-10-04 23:09:45 +09:00
parent c1cb7045fd
commit 45136c7f9c
55 changed files with 67 additions and 10 deletions

View File

@@ -75,11 +75,6 @@ subprojects {
testImplementation("org.springframework.boot:spring-boot-starter-test")
}
tasks.withType<JavaCompile> {
sourceCompatibility = "17"
targetCompatibility = "17"
}
tasks.withType<KotlinCompile> {
kotlinOptions {
freeCompilerArgs = listOf("-Xjsr305=strict")

View File

@@ -0,0 +1,3 @@
dependencies {
implementation(project(":dongne-common"))
}

View File

@@ -0,0 +1,11 @@
package io.beaniejoy.dongnecafe
import org.springframework.boot.autoconfigure.SpringBootApplication
import org.springframework.boot.runApplication
@SpringBootApplication
class DongneAccountApiApplication
fun main(args: Array<String>) {
runApplication<DongneAccountApiApplication>(*args)
}

View File

@@ -0,0 +1,5 @@
spring:
datasource:
url: jdbc:mysql://localhost:3306/dongne?autoreconnect=true&characterEncoding=utf8&serverTimezone=Asia/Seoul
username: root
password: beaniejoy # TODO 추후 보안에 대해 생각해보기

View File

@@ -0,0 +1,27 @@
spring:
profiles:
active: local
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
jpa:
hibernate:
ddl-auto: none # use [service-api] flyway migration
properties:
hibernate:
dialect: org.hibernate.dialect.MySQL5InnoDBDialect
format_sql: true
show-sql: false
open-in-view:
flyway:
enabled: false
devtools:
livereload:
enabled: false # no use devtools' LiveReload Server
server:
port: 9090
logging:
level:
org.hibernate.SQL: debug # logger 통해 로깅
# org.hibernate.type: trace

View File

@@ -4,7 +4,7 @@ import org.junit.jupiter.api.Test
import org.springframework.boot.test.context.SpringBootTest
@SpringBootTest
internal class DongneCafeServiceApiApplicationTests {
internal class DongneAccountApiApplicationTests {
@Test
fun contextLoads() {

View File

@@ -4,8 +4,8 @@ import org.springframework.boot.autoconfigure.SpringBootApplication
import org.springframework.boot.runApplication
@SpringBootApplication
class DongneCafeServiceApiApplication
class DongneServiceApiApplication
fun main(args: Array<String>) {
runApplication<DongneCafeServiceApiApplication>(*args)
runApplication<DongneServiceApiApplication>(*args)
}

View File

@@ -15,6 +15,9 @@ spring:
baseline-on-migrate: true
baseline-version: 0
locations: classpath:db/migration,classpath:db/seed
devtools:
livereload:
enabled: false # no use devtools' LiveReload Server
logging:
level:

View File

@@ -0,0 +1,12 @@
package io.beaniejoy.dongnecafe
import org.junit.jupiter.api.Test
import org.springframework.boot.test.context.SpringBootTest
@SpringBootTest
internal class DongneServiceApiApplicationTests {
@Test
fun contextLoads() {
}
}

View File

@@ -98,7 +98,7 @@ internal class CafeServiceTest {
// TODO 'findByIdOrNull'은 kotlin test 라이브러리 필요한 듯
val mockCafe = mock(Cafe::class.java)
doReturn(Optional.of(cafe)).`when`(mockCafeRepository.findById(eq(cafeId)))
`when`(mockCafeRepository.findById(cafeId)).thenReturn(Optional.of(mockCafe))
doNothing().`when`(mockCafe).updateInfo(
name = anyString(),
@@ -109,7 +109,7 @@ internal class CafeServiceTest {
// when
mockCafeService.updateInfo(
id = eq(cafeId),
id = cafeId,
name = "updated_name",
address = "updated_address",
phoneNumber = "updated_phoneNumber",

View File

@@ -1,3 +1,4 @@
rootProject.name = "dongne-cafe-api"
include("dongne-common")
include("dongne-service-api")
include("dongne-account-api")