springboot+swaggerui配置
来源:互联网 发布:学vb用什么软件 编辑:程序博客网 时间:2024/05/01 05:00
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.context.request.async.DeferredResult;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
import static springfox.documentation.builders.PathSelectors.regex;
import static com.google.common.base.Predicates.or;
@Configuration
@EnableSwagger2
public class swaggerconfig {
@Bean
public Docket testApi() {
return new Docket(DocumentationType.SWAGGER_2)
.groupName("healthData")
.genericModelSubstitutes(DeferredResult.class)
// .genericModelSubstitutes(ResponseEntity.class)
.useDefaultResponseMessages(false)
.forCodeGeneration(true)
.pathMapping("/")// base,最终调用接口后会和paths拼接在一起
.select()
.paths(or(regex("/api/.*")))//过滤的接口
.build()
.apiInfo(apiInfo());
}
private ApiInfo apiInfo() {
ApiInfo apiInfo = new ApiInfo("API",//大标题
" ",//小标题
"1.0",//版本
"NO terms of service",
"qq.com",//作者
"The Apache License, Version 2.0",//链接显示文字
"http://www.apache.org/licenses/LICENSE-2.0.html"//网站链接
);
return apiInfo;
}
}
pom中加入以下dependency
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.5.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/io.springfox/springfox-swagger2 -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.5.0</version>
</dependency>
0 0
- springboot+swaggerui配置
- SpringBoot配置SwaggerUI访问404错误
- SwaggerUI自动生成API文档(SwaggerUI+SpringBoot)
- springboot配置
- springboot配置
- SpringBoot配置
- 【SpringBoot】SpringBoot核心-基本配置
- 【SpringBoot】SpringBoot核心-外部配置
- SpringBoot-01SpringBoot配置FastJson
- SwaggerUI ASP.Net WebAPI2
- SwaggerUI ASP.Net WebAPI2
- SwaggerUI ASP.Net WebAPI2
- SwaggerUI ASP.Net WebAPI2
- SwaggerUI ASP.Net WebAPI2
- SwaggerUI ASP.Net WebAPI2
- SwaggerUI ASP.Net WebAPI2
- SwaggerUI ASP.Net WebAPI2
- SwaggerUI 自动生成文档
- Java I/O流 简单实现
- 练习2-6 编写一个函数setbits(x, p ,n, y),该函数返回对x执行下列操作后的结果值: 将x中从第p位开始的n个(二进制)位设置为y中最右边n位的值,x的其余各位保持不变。
- C#中汉语转拼音
- Android Studio下NDN-JNI技术初学
- new install ubuntu to do
- springboot+swaggerui配置
- git版本管理工具使用教程
- 最长合成字符串
- Java简单的台球运动轨迹效果实现
- Java技术——Java多线程学习
- 一机柜服务器部署iLo网过程
- DBN
- 图像运算--代数运算
- Android lame库在Windows下编译