cn.gudqs.system.configuration.SwaggerConfiguration Maven / Gradle / Ivy
package cn.gudqs.system.configuration;
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;
/**
* @author wq
* @date 2018/9/19
* @description swagger 文档
*/
@Configuration
@EnableSwagger2
public class SwaggerConfiguration {
@Bean
public Docket adminApi() {
return new Docket(DocumentationType.SWAGGER_2)
.groupName("1.后台管理")
.apiInfo(apiInfo())
.select()
.apis(RequestHandlerSelectors.basePackage("cn.gudqs.system.admin"))
.paths(PathSelectors.any())
.build();
}
@Bean
public Docket businessAll() {
return new Docket(DocumentationType.SWAGGER_2)
.groupName("3.全部业务")
.apiInfo(apiInfo())
.select()
.apis(RequestHandlerSelectors.basePackage("cn.gudqs.business"))
.paths(PathSelectors.any())
.build();
}
@Bean
public Docket commonApi() {
return new Docket(DocumentationType.SWAGGER_2)
.groupName("2.公共")
.apiInfo(apiInfo())
.select()
.apis(RequestHandlerSelectors.basePackage("cn.gudqs.business.common"))
.paths(PathSelectors.any())
.build();
}
private ApiInfo apiInfo() {
return new ApiInfoBuilder()
.title("API")
.description("接口文档")
.termsOfServiceUrl("https://xiaolouyou.com")
.version("1.0")
.build();
}
}