【Springboot系列】Springboot整合Swagger3不简单
1、缘由
Swagger是一个根据代码注解生成接口文档的工具,减少和前端之间的沟通,前端同学看着文档就可以开发了,提升了效率,之前很少写swagger,这次自己动手写,还是有点麻烦,不怎么懂,记录下,避免下次继续踩坑
2、入门
2.1、加入依赖
新建一个springboo项目,一路next就好,这里使用的maven
pom.xml中加入配置
io.springfox springfox-boot-starter 3.0.0
注:第一次用,直接选用新版的,不知道好在哪
2.2、配置类
package com.example.webdemo.config;import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.Doc
本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!
