🏗️ 프로젝트 구조 web, core, infrastructure 모듈로 분리

This commit is contained in:
jini
2022-11-30 02:59:47 +09:00
parent c72f7be010
commit b2561d6608
29 changed files with 309 additions and 111 deletions

View File

@@ -0,0 +1,11 @@
dependencies {
implementation("org.springframework.boot:spring-boot-starter-web")
implementation("org.springframework.boot:spring-boot-starter-data-jpa")
implementation("org.springframework.boot:spring-boot-starter-validation")
compileOnly("org.springframework.boot:spring-boot-configuration-processor")
implementation("org.springdoc:springdoc-openapi-ui:1.6.13")
runtimeOnly("org.mariadb.jdbc:mariadb-java-client")
implementation(project(":core:demo-core"))
implementation(project(":infrastructure:datastore-mariadb"))
}

View File

@@ -0,0 +1,17 @@
package me.jiniworld.demohx
import org.springframework.boot.autoconfigure.SpringBootApplication
import org.springframework.boot.runApplication
import java.util.*
@SpringBootApplication(scanBasePackages = [
"me.jiniworld.demohx.config",
"me.jiniworld.demohx.web",
"me.jiniworld.demohx.application"
])
class DemoAppApplication
fun main(args: Array<String>) {
Locale.setDefault(Locale.KOREA)
runApplication<DemoAppApplication>(*args)
}

View File

@@ -0,0 +1,34 @@
package me.jiniworld.demohx.web.notice
import io.swagger.v3.oas.annotations.Operation
import io.swagger.v3.oas.annotations.tags.Tag
import me.jiniworld.demohx.application.notice.port.input.GetNoticeQuery
import me.jiniworld.demohx.application.notice.domain.Notice
import me.jiniworld.demohx.application.notice.port.output.NoticeSimple
import org.springframework.data.domain.PageRequest
import org.springframework.data.domain.Sort
import org.springframework.stereotype.Component
import org.springframework.web.bind.annotation.*
@Component
//@WebAdapter
@Tag(name = "setting-system", description = "설정-시스템(공지사항, FAQ, 이용약관, 메타정보 등)")
@RestController
@RequestMapping("/v1/notices")
internal class GetNoticeController(
private val getNoticeQuery: GetNoticeQuery,
) {
@Operation(summary = "공지사항 목록")
@GetMapping("")
fun notices(
@RequestParam(value = "page", required = false, defaultValue = "0") page: Int,
@RequestParam(value = "size", required = false, defaultValue = "10") size: Int,
) = getNoticeQuery.getNoticeSimple(PageRequest.of(page, size, Sort.by(Sort.Order.desc("id"))))
@Operation(summary = "공지사항 상세조회")
@GetMapping("/{notice_id}")
fun notice(@PathVariable("notice_id") noticeId: Long) =
getNoticeQuery.getNoticeDetail(noticeId)
}

View File

@@ -0,0 +1,78 @@
spring:
application:
name: chaeking
profiles:
active: local
config:
import:
- chaeking.yml
# - vault://secret/chaeking-local
datasource:
url: jdbc:mariadb://localhost:3306/book
driver-class-name: org.mariadb.jdbc.Driver
username: test
password: test
hikari:
auto-commit: false
connection-test-query: SELECT 1
minimum-idle: 10
maximum-pool-size: 50
# transaction-isolation: TRANSACTION_READ_UNCOMMITTED
pool-name: pool-book
jpa:
database-platform: org.hibernate.dialect.MariaDB103Dialect
properties:
hibernate:
format_sql: false
hbm2ddl.auto: update
implicit_naming_strategy: org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy
physical_naming_strategy: org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy
default_batch_fetch_size: 500
open-in-view: false
show-sql: true
devtools:
add-properties: false
server:
port: 8080
tomcat:
basedir: .
# accesslog:
# enabled: true
# directory: logs
# pattern: "%{yyyy-MM-dd HH:mm:ss}t %{X-Forwarded-For}i(%h) %l %u \"%r\" %s %b"
remoteip:
protocol-header: X-Forwarded-Proto
remote-ip-header: X-Forwarded-For
springdoc:
api-docs:
path: /api-docs
default-consumes-media-type: application/json
default-produces-media-type: application/json
swagger-ui:
operations-sorter: alpha
tags-sorter: alpha
path: /
disable-swagger-default-url: true
doc-expansion: none
syntax-highlight:
theme: nord
paths-to-match:
- /v1/**
- /temp/**
- /data4library/**
logging:
# file:
# name: logs/check.log
exception-conversion-word: '%wEx'
pattern:
console: '%d{yyyy-MM-dd HH:mm:ss.SSS} %clr(${LOG_LEVEL_PATTERN:%-5p}){green} %clr([%22thread]){magenta} %clr(%-40.40logger{39}){cyan} %clr(: %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}){faint}'
level:
web: debug
org:
springframework:
web:
servlet: debug

View File

@@ -0,0 +1,7 @@
chaeking:
version: 1.0.1
url: http://localhost:${server.port}
book-search:
kakao:
api-url: https://dapi.kakao.com