<dependency> <groupId>io.springfox</groupId> <artifactId>springfox-swagger2</artifactId> <version>2.6.1</version> </dependency> <dependency> <groupId>io.springfox</groupId> <artifactId>springfox-swagger-ui</artifactId> <version>2.6.1</version> </dependency>
/**
* Swagger配置
*
* @author wq
* @since 2017-05-16
*/
@EnableWebMvc
@EnableSwagger2
@Configuration
public class SwaggerConfig {
@Bean
public Docket createRestApi() {
return new Docket(DocumentationType.SWAGGER_2)
.apiInfo(apiInfo())
.select()
.apis(RequestHandlerSelectors.basePackage("com.z*.b*.c*.controller"))
// 注意修改此处的包名
.paths(PathSelectors.any())
.build();
}
private ApiInfo apiInfo() {
return new ApiInfoBuilder()
.title("接口列表 v1.1.0") // 任意,请稍微规范点
.description("接口测试") // 任意,请稍微规范点
.termsOfServiceUrl("http://url/swagger-ui.html")
// 将“url”换成自己的ip:port
.contact("laowu") // 无所谓(这里是作者的别称)
.version("1.1.0")
.build();
}
}
<mvc:resources mapping="swagger-ui.html" location="classpath:/META-INF/resources/"/> <mvc:resources mapping="/webjars/**" location="classpath:/META-INF/resources/webjars/"/>
<mvc:exclude-mapping path="/swagger*/**"></mvc:exclude-mapping> <mvc:exclude-mapping path="/v2/**"></mvc:exclude-mapping> <mvc:exclude-mapping path="/webjars/**"></mvc:exclude-mapping>
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有