- 授权协议: Apache
- 开发语言: Java
- 操作系统: 跨平台
- 软件首页: https://git.oschina.net/xiaoym/swagger-bootstrap-ui
- 软件文档: http://www.xiaominfo.com/swagger-bootstrap-ui/
软件介绍
swagger-bootstrap-ui
GitHub Gitee 项目文档 项目demo 在线体验
简介
swagger-bootstrap-ui是Swagger的前端UI实现,目的是替换Swagger默认的UI实现Swagger-UI,使文档更友好一点儿....
swagger-bootstrap-ui 只是Swagger的UI实现,并不是替换Swagger功能,所以后端模块依然是依赖Swagger的,需要配合Swagger的注解达到效果,注解说明
在线效果体验:http://swagger-bootstrap-ui.xiaominfo.com/doc.html
功能
- 接口文档说明,效果图如下:
- 在线调试功能,效果图如下:
Swagger简介
Swagger 是一个规范和完整的框架,用于生成、描述、调用和可视化 RESTful 风格的 Web 服务。总体目标是使客户端和文件系统作为服务器以同样的速度来更新。文件的方法,参数和模型紧密集成到服务器端的代码,允许API来始终保持同步。Swagger 让部署管理和使用功能强大的API从未如此简单。
demo演示
下载
swagger-bootstrap-ui下载地址:下载
使用说明
- 首先需要引入swagger的配置包信息,如下:
io.springfox
springfox-swagger2
2.2.2
io.springfox
springfox-swagger-ui
2.2.2
- maven项目中引用
swagger-bootstrap-ui的jar包依赖,如下:
com.github.xiaoymin
swagger-bootstrap-ui
1.7.5
- Spring项目中启用swagger,代码如下:
1.注解方式
@Configuration
@EnableSwagger2
public class SwaggerConfiguration {
@Bean
public Docket createRestApi() {
return new Docket(DocumentationType.SWAGGER_2)
.apiInfo(apiInfo())
.select()
.apis(RequestHandlerSelectors.basePackage("com.bycdao.cloud"))
.paths(PathSelectors.any())
.build();
}
private ApiInfo apiInfo() {
return new ApiInfoBuilder()
.title("swagger-bootstrap-ui RESTful APIs")
.description("swagger-bootstrap-ui")
.termsOfServiceUrl("http://localhost:8999/")
.contact("developer@mail.com")
.version("1.0")
.build();
}
}
swagger-bootstrap-ui默认访问地址是:http://${host}:${port}/doc.html
注意事项
- swagger封装给出的请求地址默认是
/v2/api-docs,所以swagger-bootstrap-ui调用后台也是/v2/api-docs,不能带后缀,且需返回json格式数据,框架如果是spring boot的可以不用修改,直接使用,如果是Spring MVC在web.xml中配置了DispatcherServlet,则需要追加一个url匹配规则,如下:
cmsMvc
org.springframework.web.servlet.DispatcherServlet
contextConfigLocation
classpath:config/spring.xml
1
cmsMvc
*.htm
cmsMvc
/v2/api-docs
鸣谢
特别感谢以下大牛开发的js/css、html前端框架,美观、易用
| 框架 | 网站 |
|---|---|
| jquery | http://jquery.com/ |
| bootstrap | http://getbootstrap.com |
| layer | http://layer.layui.com/ |
| jsonview | https://github.com/yesmeck/jquery-jsonview |
New Dark Age
James Bridle / Verso Books / 2018-7-17 / GBP 16.99
As the world around us increases in technological complexity, our understanding of it diminishes. Underlying this trend is a single idea: the belief that our existence is understandable through comput......一起来看看 《New Dark Age》 这本书的介绍吧!
