swagger配置

parent 96dd9db7
...@@ -116,6 +116,15 @@ ...@@ -116,6 +116,15 @@
<artifactId>spring-boot-starter-test</artifactId> <artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<!-- swagger2接口文档 -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
</dependency>
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>swagger-bootstrap-ui</artifactId>
</dependency>
</dependencies> </dependencies>
......
package com.jz.manage.config.swaggerConfig;
import com.github.xiaoymin.swaggerbootstrapui.annotations.EnableSwaggerBootstrapUI;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
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;
/**
* @ClassName: SwaggerConfiguration
* @Author Bellamy
* @Date 2020/11/26
*/
@Configuration
@EnableSwagger2
@EnableSwaggerBootstrapUI
public class SwaggerConfiguration {
@Bean
public Docket createRestApi() {
return new Docket(DocumentationType.SWAGGER_2)
.apiInfo(apiInfo())
.select()
.apis(RequestHandlerSelectors.basePackage("com.jz.manage.admin.controller"))
.paths(PathSelectors.any())
.build();
}
private ApiInfo apiInfo() {
return new ApiInfoBuilder()
.title("数据商城 RESTful APIs")
.description("swagger-bootstrap-ui")
.termsOfServiceUrl("http://localhost:5050/")
.contact("Bellamy")
.version("1.0")
.build();
}
}
...@@ -43,6 +43,8 @@ ...@@ -43,6 +43,8 @@
<disconf.version>2.6.35</disconf.version> <disconf.version>2.6.35</disconf.version>
<junit.version>4.12</junit.version> <junit.version>4.12</junit.version>
<commons-lang3.version>3.8.1</commons-lang3.version> <commons-lang3.version>3.8.1</commons-lang3.version>
<springfox-swagger2.version>2.9.2</springfox-swagger2.version>
<swagger-bootstrap-ui.version>1.9.6</swagger-bootstrap-ui.version>
</properties> </properties>
<dependencyManagement> <dependencyManagement>
...@@ -184,6 +186,17 @@ ...@@ -184,6 +186,17 @@
<artifactId>commons-lang3</artifactId> <artifactId>commons-lang3</artifactId>
<version>${commons-lang3.version}</version> <version>${commons-lang3.version}</version>
</dependency> </dependency>
<!-- swagger2接口文档 -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>${springfox-swagger2.version}</version>
</dependency>
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>swagger-bootstrap-ui</artifactId>
<version>${swagger-bootstrap-ui.version}</version>
</dependency>
</dependencies> </dependencies>
</dependencyManagement> </dependencyManagement>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment