1、緣由
???Swagger是一個根據(jù)代碼注解生成接口文檔的工具,減少和前端之間的溝通,前端同學(xué)看著文檔就可以開發(fā)了,提升了效率,之前很少寫swagger,這次自己動手寫,還是有點麻煩,不怎么懂,記錄下,避免下次繼續(xù)踩坑
2、入門
2.1、加入依賴
? ? ? ? 新建一個springboo項目,一路next就好,這里使用的maven
pom.xml中加入配置文章來源:http://www.zghlxwxcb.cn/news/detail-447443.html
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-boot-starter</artifactId>
<version>3.0.0</version>
</dependency>
注:第一次用,直接選用新版的,不知道好在哪文章來源地址http://www.zghlxwxcb.cn/news/detail-447443.html
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
到了這里,關(guān)于【Springboot系列】Springboot整合Swagger3不簡單的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!