Spring 集成 Swagger UI
<!-- Spring -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>1.5.3.RELEASE</version>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
</exclusions>
</dependency> <dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-log4j2</artifactId>
<version>1.5.3.RELEASE</version>
</dependency> <dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jetty</artifactId>
<version>1.5.3.RELEASE</version>
<exclusions>
<exclusion>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
</exclusion>
</exclusions>
</dependency> <dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.7.0</version>
</dependency> <dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.7.0</version>
</dependency> <dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
<version>1.5.13</version>
</dependency>
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController; @RestController
public class ExampleController { @RequestMapping(value = "hello/{name}", method = RequestMethod.GET)
public String greeting(@PathVariable("name") String name) {
return "hello my friend : " + name;
} }
访问地址 xxxx:8080/v2/api-docs 可以查看json数据
访问 xxxx:8080/swagger-ui.html 直接查看ui
参考文档
http://www.baeldung.com/swagger-2-documentation-for-spring-rest-api
http://www.conglin-site.com/document/html/1494763157.html
https://github.com/swagger-api/swagger-core/wiki/Annotations-1.5.X#apiparam
Spring 集成 Swagger UI的更多相关文章
- 15、Spring Boot 2.x 集成 Swagger UI
1.15.Spring Boot 2.x 集成 Swagger UI 完整源码: Spring-Boot-Demos 1.15.1 pom文件添加swagger包 <swagger2.versi ...
- 在Abp中集成Swagger UI功能
在Abp中集成Swagger UI功能 1.安装Swashbuckle.Core包 通过NuGet将Swashbuckle.Core包安装到WebApi项目(或Web项目)中. 2.为WebApi方法 ...
- asp.net core 集成swagger ui
什么是Swagger? 说swagger 之前,我们先说一下OpenApi 规范. OpenApi 是一种和语言无关的用于描述RESTAPIs 接口功能的一种规范,对RESTAPIs 接口的描述包括: ...
- spring集成swagger
随着互联网技术的发展,现在的网站架构基本都由原来的后端渲染,变成了:前端渲染.前后端分离的形态,而且前端技术和后端技术在各自的道路上越走越远. 前端和后端的唯一联系,变成了API接口:API文档变成了 ...
- springboot 集成swagger ui
springboot 配置swagger ui 1. 添加依赖 <!-- swagger ui --> <dependency> <groupId>io.sprin ...
- 【Spring Boot&&Spring Cloud系列】Spring Boot项目集成Swagger UI
前言 Swagger 是一个规范和完整的框架,用于生成.描述.调用和可视化 RESTful 风格的 Web 服务.总体目标是使客户端和文件系统作为服务器以同样的速度来更新.文件的方法,参数和模型紧密集 ...
- Spring集成swagger步骤(包含Header)
1.添加依赖,2.4.0: <dependency> <groupId>io.springfox</groupId> <artifactId>sprin ...
- Spring集成Swagger,Java自动生成Api文档
博主很懒... Swagger官网:http://swagger.io GitHub地址:https://github.com/swagger-api 官方注解文档:http://docs.swagg ...
- 【转】C# ABP WebApi与Swagger UI的集成
以前在做WebAPI调用测试时,一直在使用Fiddler测试工具了,而且这个用起来比较繁琐,需要各种配置,并且不直观,还有一点是还得弄明白URL地址和要传递的参数,然后才能调用. 最近新入职,公司里 ...
随机推荐
- webapi 统一处理时间格式
public class UnixDateTimeConvertor : DateTimeConverterBase { public override object ReadJson(JsonRea ...
- python学习笔记(四)
模块与包 python模块,一个.py文件 导入模块的语法: import importable importable#可以是包或包中的模块 import importable1,....,impo ...
- Linux 依据关键字查找正在运行的进程
ps aux |grep tm1s
- MISCONF Redis is configured to save RDB snapshots, but it is currently not able to persist on disk. Commands that may modify the data set are disabled, because this instance is configured to report e
早上来到公司,线上的项目报错: Error in execution; nested exception is io.lettuce.core.RedisCommandExecutionExcepti ...
- 【Zookeeper系列】Zookeeper命令操作(转)
原文链接:https://www.cnblogs.com/sunddenly/p/4031881.html 一.Zookeeper的四字命令 Zookeeper支持某些特定的四字命令字母与其的交互.他 ...
- Spring Boot Starter 的基本封装
1)spring-boot-starter这是Spring Boot的核心启动器,包含了自动配置.日志和YAML. 2)spring-boot-starter-amqp通过spring-rabbit来 ...
- python nose测试框架全面介绍十二 ----用例执行顺序打乱
在实际执行自动化测试时,发现我们的用例在使用同一个资源的操作时,用例的执行顺序对测试结果有影响,在手工测试时是完全没法覆盖的. 但每一次都是按用例名字来执行,怎么打乱来执行的. 在网上看到一个有意思的 ...
- Timer和时间调度
Timer作为JDK提供的util工具,不太适合作为周期调度任务,只适合简单的定时操作(按照一定时间频率出发任务),在java的领域解决方案中,Quartz无疑是翘楚. Timer的调度方法有: pu ...
- React 学习之路 (一)
先说一说对React的体验,总结 首先react相对angular来说入手简单暴力,在学习的这段时间里发现: 我们每天做的事就是在虚拟DOM上创建元素然后在渲染到真实的DOM中 渲染到真实DOM上的R ...
- [tldk][dpdk][dev] TLDK--基于dpdk的用户态协议栈传输层组件简单调研
如题,以下是一份简单的快速调研. TLDK: Transport Layer Development Kit 一 什么是TLDK transport layer development kit 处理t ...