SpringBoot快速整合Swagger

2021-10-03 07:23:18 字數 1457 閱讀 3797

注意:生產版本發布後,關閉swagger!!!

springboot已經整合了swagger,使用簡單註解即可生成swagger的api文件。

@api:修飾整個類,描述controller的作用

@apioperation:描述乙個類的乙個方法,或者說乙個介面

@apiparam:單個引數描述

@apimodel:用物件來接收引數

@apiproperty:用物件接收引數時,描述物件的乙個字段

@apiresponse:http響應其中1個描述

@apiresponses:http響應整體描述

@apiignore:使用該註解忽略這個api

@apierror :發生錯誤返回的資訊

@apiimplicitparam:乙個請求引數

@apiimplicitparams:多個請求引數

io.springfox

springfox-swagger2

2.8.0

io.springfox

springfox-swagger-ui

2.8.0

@configuration

@enableswagger2

public class swaggerconfig

private apiinfo apiinfo()

}

@restcontroller

@api("訂單服務介面")

public class ordercontroller

/*** 分頁查詢當前使用者訂單

** @param status 訂單狀態

* @return 分頁訂單資料

*/@apioperation(value = "分頁查詢當前使用者訂單,並且可以根據訂單狀態過濾",

notes = "分頁查詢當前使用者訂單")

springBoot快速整合Druid

簡介 springboot快速整合druid 一 pom檔案引入druid依賴 com.alibaba druid spring boot starter 1.1.1 二 基本配置 資料庫連線資訊 spring.datasource.druid.url jdbc mysql spring.datas...

springboot快速整合log日誌,快速上手

ch.qos.logback logback classic 1.2.3 compile org.apache.logging.log4j log4j to slf4j 2.10.0 compile org.slf4j jul to slf4j 1.7.25 compile 在resources 新...

springboot整合JPA的快速使用

這是專案結構 先導入依賴 org.springframework.boot spring boot starter data jpa 其次配置yml檔案 spring datasource driver class name com.mysql.jdbc.driver url jdbc mysql ...