From e5076a96fa26d121142a53ecb658069e37308a96 Mon Sep 17 00:00:00 2001 From: keymasroy Date: Tue, 21 Dec 2021 23:32:54 +0900 Subject: [PATCH] =?UTF-8?q?swagger=20=EC=84=A4=EC=A0=95=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- back/root/bo/build.gradle | 2 + .../java/bo/config/SwaggerConfiguration.java | 50 +++++++++++++++++++ .../bo/src/main/resources/application.yml | 12 ++--- 3 files changed, 58 insertions(+), 6 deletions(-) create mode 100644 back/root/bo/src/main/java/sample/ustraframework/java/bo/config/SwaggerConfiguration.java diff --git a/back/root/bo/build.gradle b/back/root/bo/build.gradle index fe986e0..c3260c7 100644 --- a/back/root/bo/build.gradle +++ b/back/root/bo/build.gradle @@ -8,6 +8,8 @@ repositories { dependencies { compile "com.gsitm.ustra.java.starter:ustra-starter-vue-bo:${ustraVersion}" + compile 'io.springfox:springfox-swagger2:2.9.2' + compile 'io.springfox:springfox-swagger-ui:2.9.2' compile project(":cmm") } diff --git a/back/root/bo/src/main/java/sample/ustraframework/java/bo/config/SwaggerConfiguration.java b/back/root/bo/src/main/java/sample/ustraframework/java/bo/config/SwaggerConfiguration.java new file mode 100644 index 0000000..ffc8b40 --- /dev/null +++ b/back/root/bo/src/main/java/sample/ustraframework/java/bo/config/SwaggerConfiguration.java @@ -0,0 +1,50 @@ +package sample.ustraframework.java.bo.config; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.security.config.annotation.web.builders.WebSecurity; + +import com.gsitm.ustra.java.security.config.UstraSecurityConfigure; + +import springfox.documentation.builders.ApiInfoBuilder; +import springfox.documentation.builders.PathSelectors; +import springfox.documentation.builders.RequestHandlerSelectors; +import springfox.documentation.service.ApiInfo; +import springfox.documentation.spi.DocumentationType; +import springfox.documentation.spring.web.plugins.Docket; +import springfox.documentation.swagger2.annotations.EnableSwagger2; + +@Configuration +@EnableSwagger2 +public class SwaggerConfiguration { + @Bean + public Docket swaggerApi() { + return new Docket(DocumentationType.SWAGGER_2) + .useDefaultResponseMessages(false) + .select() + .apis(RequestHandlerSelectors.basePackage("sample.ustraframework.java")) + .paths(PathSelectors.ant("/api/**")) + .build() + .apiInfo(swaggerInfo()); + } + + private ApiInfo swaggerInfo() { + return new ApiInfoBuilder() + .title("U.STRA Framework System Swagger") + .description("U.STRA Framework System API 문서") + //.license("HDHS Help System") + //.licenseUrl("http://www.swaggerSample.com") + .version("1.0.0") + .build(); + } + + @Bean + UstraSecurityConfigure swaggerSecurityConfigure() { + return new UstraSecurityConfigure() { + @Override + public void postConfigure(WebSecurity web) throws Exception { + web.ignoring().antMatchers("/v2/api-docs", "/swagger-resources/**", "/swagger-ui.html", "/webjars/**"); + } + }; + } +} diff --git a/back/root/bo/src/main/resources/application.yml b/back/root/bo/src/main/resources/application.yml index 0168376..6fe87f2 100644 --- a/back/root/bo/src/main/resources/application.yml +++ b/back/root/bo/src/main/resources/application.yml @@ -16,10 +16,7 @@ mybatis: jdbc-type-for-null: "NULL" # mapUnderscoreToCamelCase: true ---- -spring: - profiles: local - + ustra: core: process-info: @@ -37,13 +34,16 @@ ustra: password: ENC(ohS/a1/Q/lKriwUq3rqJqht76fQ0Bnge) file: enabled: true - group: - enabled: true mvc: view: api-prefix: api client-crypto-key: Z3NjLWNyeXB0by1rZXkxMQ== type: STATIC_THYEMELEAF + rest: + exclude-wrapping-url-patterns: /v2/api-docs,/swagger-resources/**,/swagger-ui.html,/webjars/** + wrapper: + exclude-request-url-patterns: /v2/api-docs + exclude-response-url-patterns: /v2/api-docs management: bo: app: