Swagger制作api
2021-01-28 21:14
标签:sel depend spring color htm pat com build ble 要制作哪个服务模块的在哪个服务里写 1.导入依赖 springfox-swagger2 springfox-swagger-ui 2.导入制作api模板 3.访问:http://localhost:8085/swagger-ui.html Swagger制作api 标签:sel depend spring color htm pat com build ble 原文地址:https://www.cnblogs.com/3hhh/p/11879171.htmlimport 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;
@Configuration
@EnableSwagger2
public class SwaggerConfig {
@Bean
public Docket api() {
return new Docket(DocumentationType.SWAGGER_2)
.host("localhost:8085")
.apiInfo(apiInfo())
.select()
.apis(RequestHandlerSelectors.basePackage("com.leyou.user.controller"))
.paths(PathSelectors.any())
.build();
}
private ApiInfo apiInfo() {
return new ApiInfoBuilder()
.title("xx商城用户中心")
.description("xx商城用户中心接口文档")
.version("1.0")
.build();
}
}
上一篇:WPF CefSharp 爬虫