From 3c69326ee6b9b761652daa7449e26b04b681b592 Mon Sep 17 00:00:00 2001 From: dainnida Date: Sat, 11 Jan 2025 18:25:53 +0900 Subject: [PATCH] =?UTF-8?q?Feat:=20swaggerdoc=20=EC=97=B0=EB=8F=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle | 4 ++++ .../mercury/global/config/SwaggerConfig.java | 24 +++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 src/main/java/com/cmc/mercury/global/config/SwaggerConfig.java diff --git a/build.gradle b/build.gradle index d7dbb27..5a9a32d 100644 --- a/build.gradle +++ b/build.gradle @@ -28,6 +28,10 @@ dependencies { implementation 'org.springframework.boot:spring-boot-starter-security' implementation 'org.springframework.boot:spring-boot-starter-validation' implementation 'org.springframework.boot:spring-boot-starter-web' + + // swagger + implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.6.0' + compileOnly 'org.projectlombok:lombok' runtimeOnly 'com.mysql:mysql-connector-j' annotationProcessor 'org.projectlombok:lombok' diff --git a/src/main/java/com/cmc/mercury/global/config/SwaggerConfig.java b/src/main/java/com/cmc/mercury/global/config/SwaggerConfig.java new file mode 100644 index 0000000..fe6fa0e --- /dev/null +++ b/src/main/java/com/cmc/mercury/global/config/SwaggerConfig.java @@ -0,0 +1,24 @@ +package com.cmc.mercury.global.config; + +import io.swagger.v3.oas.models.OpenAPI; +import io.swagger.v3.oas.models.Components; +import io.swagger.v3.oas.models.info.Info; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +@Configuration +public class SwaggerConfig { + + @Bean + public OpenAPI openAPI() { + return new OpenAPI() + .components(new Components()) + .info(apiInfo()); + } + private Info apiInfo() { + return new Info() + .title("Mercury API Docs") + .description("Mercury API 명세서") + .version("1.0.0"); + } +}