diff --git a/build.gradle b/build.gradle index fecf192..e4a47e1 100644 --- a/build.gradle +++ b/build.gradle @@ -25,6 +25,28 @@ dependencies { // Web 기본 implementation 'org.springframework.boot:spring-boot-starter-web' + + // Lombok + compileOnly 'org.projectlombok:lombok' + annotationProcessor 'org.projectlombok:lombok' + + // jdbc + implementation 'org.bgee.log4jdbc-log4j2:log4jdbc-log4j2-jdbc4.1:1.16' + + // MariaDB + implementation 'org.mariadb.jdbc:mariadb-java-client' + + // swagger + implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.6.0' + + // MyBatis (Boot 3 전용) + implementation 'org.mybatis.spring.boot:mybatis-spring-boot-starter:3.0.3' + + // validation + implementation 'org.springframework.boot:spring-boot-starter-validation' + + // health + implementation 'org.springframework.boot:spring-boot-starter-actuator' } tasks.named('test') { diff --git a/src/main/java/com/alist/api/config/OpenApiConfig.java b/src/main/java/com/alist/api/config/OpenApiConfig.java new file mode 100644 index 0000000..9a74fe0 --- /dev/null +++ b/src/main/java/com/alist/api/config/OpenApiConfig.java @@ -0,0 +1,16 @@ +package com.alist.api.config; + +import io.swagger.v3.oas.annotations.OpenAPIDefinition; +import io.swagger.v3.oas.annotations.info.Info; +import org.springframework.context.annotation.Configuration; + +@Configuration +@OpenAPIDefinition( + info = @Info( + title = "A*List Api App", + version = "v1", + description = "A*List Api App 입니다." + ) +) +public class OpenApiConfig { +} diff --git a/src/main/resources/application-local.yaml b/src/main/resources/application-local.yaml index 642f4b9..c08debb 100644 --- a/src/main/resources/application-local.yaml +++ b/src/main/resources/application-local.yaml @@ -1,5 +1,17 @@ spring: application: name: api + datasource: + url: jdbc:log4jdbc:mariadb://121.160.234.222:3000/ALISTLMS?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Seoul&connectionCollation=utf8mb4_unicode_ci + username: alist_dev + password: 1qaz2wsx!@ + driver-class-name: net.sf.log4jdbc.sql.jdbcapi.DriverSpy + logging: config: classpath:logback-local.xml + +springdoc: + api-docs: + enabled: true + swagger-ui: + enabled: true \ No newline at end of file diff --git a/src/main/resources/application-pjt.yaml b/src/main/resources/application-pjt.yaml index 792502f..42cab57 100644 --- a/src/main/resources/application-pjt.yaml +++ b/src/main/resources/application-pjt.yaml @@ -1,5 +1,19 @@ spring: application: name: api + main: + banner-mode: log + datasource: + url: jdbc:log4jdbc:mariadb://${DB_HOST}:${DB_PORT}/${DB_NAME}?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Seoul&connectionCollation=utf8mb4_unicode_ci + username: ${DB_USERNAME} + password: ${DB_PASSWORD} + driver-class-name: net.sf.log4jdbc.sql.jdbcapi.DriverSpy + logging: config: classpath:logback-pjt.xml + +springdoc: + api-docs: + enabled: true + swagger-ui: + enabled: true \ No newline at end of file diff --git a/src/main/resources/application.yaml b/src/main/resources/application.yaml index e9aeac8..926d19e 100644 --- a/src/main/resources/application.yaml +++ b/src/main/resources/application.yaml @@ -1,6 +1,29 @@ server: port: 8106 forward-headers-strategy: framework + spring: application: name: api + +mybatis: + mapper-locations: classpath:mapper/**/*.xml + type-aliases-package: com.alist.api + configuration: + map-underscore-to-camel-case: true + log-impl: org.apache.ibatis.logging.slf4j.Slf4jImpl + +springdoc: + swagger-ui: + path: /swagger + api-docs: + path: /v3/api-docs + +management: + endpoints: + web: + exposure: + include: health,info,metrics + endpoint: + health: + show-details: always \ No newline at end of file diff --git a/src/main/resources/log4jdbc.log4j2.properties b/src/main/resources/log4jdbc.log4j2.properties new file mode 100644 index 0000000..1b22fc5 --- /dev/null +++ b/src/main/resources/log4jdbc.log4j2.properties @@ -0,0 +1,3 @@ +log4jdbc.spylogdelegator.name=net.sf.log4jdbc.log.slf4j.Slf4jSpyLogDelegator +log4jdbc.drivers=org.mariadb.jdbc.Driver +log4jdbc.dump.sql.maxlinelength=0 \ No newline at end of file diff --git a/src/main/resources/logback-local.xml b/src/main/resources/logback-local.xml index b6cc10e..17ddb53 100644 --- a/src/main/resources/logback-local.xml +++ b/src/main/resources/logback-local.xml @@ -4,6 +4,9 @@ + + + @@ -11,12 +14,29 @@ + + + - + + + + + + + + + + + + + + + diff --git a/src/main/resources/logback-pjt.xml b/src/main/resources/logback-pjt.xml index 83f287d..772bdd7 100644 --- a/src/main/resources/logback-pjt.xml +++ b/src/main/resources/logback-pjt.xml @@ -36,7 +36,21 @@ - + + + + + + + + + + + + + + +