springboot 配置swagger ui

1. 添加依赖

<!-- swagger ui -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.2.2</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.2.2</version>
</dependency>

2. 启动swagger ui注解

@SpringBootApplication
@EnableSwagger2
public class Main { public static void main(String[] args) throws Exception {
SpringApplication.run(Main.class, args);
}
}

3.添加 controller注解

@RestController
@RequestMapping("/user")
@Api("swagger ui 注释 api 级别")
public class HelloWorldController { @ApiOperation("swagger ui 注释 方法级别")
@RequestMapping(value="/hello",method=RequestMethod.GET)
public String hello() {
String data = "Never trouble untill trouble troubles you. Some one told me some years ago.";
return data;
}
}

4. swagger ui 链接: localhost:8080//swagger-ui.html (默认)

参考这里

最新文章

  1. jquery.validate 使用--验证表单隐藏域
  2. 安装 modelsim 10.4
  3. HashTable、HashMap、HashSet
  4. lua语法备忘录
  5. JQuery选择器使用
  6. 制作BibTex文件
  7. 一个int类型究竟占多少个字节
  8. View原理
  9. hdu 1814 Peaceful Commission (2-sat 输出字典序最小的路径)
  10. 11 款最好 CSS 框架
  11. Android如何调用第三方SO库(转)
  12. 一些很容易被忘记的css
  13. Could not install the app on the device, read the error above for details. Make sure you have an Android emulator running or a device connected and have set up your Android development environment:
  14. python-迭代器、生成器、内置函数及面向过程编程
  15. 20181014xlVBA获取小题零分名单
  16. 6 云计算系列之Nova安装与配置
  17. Number常用方法函数
  18. 如何将同一 VNET 下的虚拟机从经典部署模型迁移到 Azure Resource Manager
  19. 使用RunWith注解改变JUnit的默认执行类,并实现自已的Listener
  20. Selenium2+python自动化

热门文章

  1. [Docker] Download and Remove Docker Images
  2. Python 标准库和第三方库的安装位置、Python 第三方库安装的各种问题及解决
  3. 小强的HTML5移动开发之路(47)——jquery mobile基本的页面框架
  4. 【codeforces 754A】Lesha and array splitting
  5. springmvc中controller内方法跳转forward?redirect?
  6. [NPM] Run npm scripts in series
  7. Xcode编译Undefined symbols for architecture xxx 错误总结
  8. 【26.09%】【codeforces 579C】A Problem about Polyline
  9. Android开发之assets目录下资源使用总结
  10. 不安装 oracle的客户,就可以使用pl/sql访问远程oracle 数据库的方法