forest/src/main/java/com/rymcu/vertical/config/Swagger2Configuration.java

40 lines
1.3 KiB
Java
Raw Normal View History

2019-11-16 20:11:38 +08:00
package com.rymcu.vertical.config;
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;
2019-12-02 09:39:23 +08:00
/**
* @author ronger
*/
2019-11-16 20:11:38 +08:00
@Configuration
@EnableSwagger2
public class Swagger2Configuration {
@Bean
public Docket createRestApi() {
return new Docket(DocumentationType.SWAGGER_2)
.apiInfo(apiInfo())
.select()
2019-12-02 09:39:23 +08:00
.apis(RequestHandlerSelectors.basePackage("com.rymcu.vertical.web.api"))
2019-11-16 20:11:38 +08:00
.paths(PathSelectors.any())
.build();
}
private ApiInfo apiInfo() {
return new ApiInfoBuilder()
.title("Vertical项目接口文档")
.description("Vertical项目相关接口的文档")
.termsOfServiceUrl("http://www.rymcu.com")
.version("1.0")
.build();
}
}