意義
寫好的接口可以直接測了 不需要postman中自己輸入
環境
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.6.1</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.6.1</version>
</dependency>

springboot配置




接口
注解

controll改變

簡單的改變

入參改變

工具使用
地址
輸入 http://localhost:8080/swagger-ui.html#/

token處理

沒有Authorize的按鈕
Captcha驗證碼實現
注意
1、照片是后台發的(不需要授權) 發的是照片+uuid 現在使用后台的驗證 (可以配置驗證碼的模式)
文件下載

文件上傳
同下載
wagger-bootstrap-ui 的使用

wagger-bootstrap-ui 的介紹

跨域問題
報錯
Access to XMLHttpRequest at 'http://192.168.1.104:8000/api/user/token' from origin 'http://localhost:8080' has been blocked by CORS policy:
Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
接口增加描述
BEAN 實體

接口 實體



