diff --git a/cws-service/pom.xml b/cws-service/pom.xml index e2310289..51c9d777 100644 --- a/cws-service/pom.xml +++ b/cws-service/pom.xml @@ -255,6 +255,19 @@ org.xmlunit xmlunit-core + + + org.webjars + bootstrap + + + io.springfox + springfox-swagger2 + + + io.springfox + springfox-swagger-ui + diff --git a/cws-service/src/main/java/jpl/cws/controller/SwaggerConfig.java b/cws-service/src/main/java/jpl/cws/controller/SwaggerConfig.java new file mode 100644 index 00000000..c81d3029 --- /dev/null +++ b/cws-service/src/main/java/jpl/cws/controller/SwaggerConfig.java @@ -0,0 +1,43 @@ +package jpl.cws.controller; + +import org.springframework.context.annotation.Bean; +import org.springframework.web.servlet.config.annotation.EnableWebMvc; +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.swagger.web.UiConfiguration; +import springfox.documentation.swagger.web.UiConfigurationBuilder; +import springfox.documentation.swagger2.annotations.EnableSwagger2; + +@EnableSwagger2 +@EnableWebMvc +public class SwaggerConfig { + @Bean + public Docket api() { + return new Docket(DocumentationType.SWAGGER_2) + .select() + .apis(RequestHandlerSelectors.any()) + .paths(PathSelectors.any()) + .build() + .apiInfo(apiInfo()); + } + + private ApiInfo apiInfo() { + return new ApiInfoBuilder() + .title("API") + .description("API Desc") + .version("V1") + .build(); + } + + @Bean + public UiConfiguration uiConfiguration() { + return UiConfigurationBuilder + .builder() + .defaultModelExpandDepth(-1) + .build(); + } +} diff --git a/cws-ui/src/main/webapp/WEB-INF/springmvc-servlet.xml b/cws-ui/src/main/webapp/WEB-INF/springmvc-servlet.xml index c63e7d1e..08b5f21a 100644 --- a/cws-ui/src/main/webapp/WEB-INF/springmvc-servlet.xml +++ b/cws-ui/src/main/webapp/WEB-INF/springmvc-servlet.xml @@ -14,6 +14,11 @@ + + + + + diff --git a/cws-ui/src/main/webapp/WEB-INF/web.xml b/cws-ui/src/main/webapp/WEB-INF/web.xml index ad32b0ec..84346272 100644 --- a/cws-ui/src/main/webapp/WEB-INF/web.xml +++ b/cws-ui/src/main/webapp/WEB-INF/web.xml @@ -65,6 +65,19 @@ /initiators /logout /not_authorized + /swagger-ui/index.html + /swagger-ui/springfox.css + /swagger-ui/swagger-ui.css + /swagger-ui/springfox.js + /swagger-ui/swagger-ui.js + /swagger-ui/swagger-ui-bundle.js + /swagger-ui/swagger-ui-standalone-preset.js + /swagger-ui/favicon-32x32.png + /swagger-ui/favicon-16x16.png + /swagger-resources/configuration/ui + /swagger-resources/configuration/security + /swagger-resources + /v2/api-docs *.mvc diff --git a/pom.xml b/pom.xml index 3149aac6..998d4bb0 100644 --- a/pom.xml +++ b/pom.xml @@ -633,6 +633,22 @@ ${xmlunit.version} + + org.webjars + bootstrap + 3.4.0 + + + io.springfox + springfox-swagger2 + 3.0.0 + + + io.springfox + springfox-swagger-ui + 3.0.0 + +