<kbd id="afajh"><form id="afajh"></form></kbd>
<strong id="afajh"><dl id="afajh"></dl></strong>
    <del id="afajh"><form id="afajh"></form></del>
        1. <th id="afajh"><progress id="afajh"></progress></th>
          <b id="afajh"><abbr id="afajh"></abbr></b>
          <th id="afajh"><progress id="afajh"></progress></th>

          SwaggerSpringBootStarter在 spring-boot 中使用 swagger

          聯(lián)合創(chuàng)作 · 2023-10-01 07:44

          在spring-boot中使用swagger,可以實現(xiàn)對代碼無侵入地集成swagger

          使用時的項目配置

          需要在spring boot項目中使用,下面按照使用maven構建項目,以使用application.properties文件來配置進行介紹, 如果使用其他的構建工具或配置文件,做相應的變更即可

          在maven配置文件pom.xml中添加依賴

          <dependency>
              <groupId>cn.songxinqiang</groupId>
              <artifactId>swagger-spring-boot-starter</artifactId>
              <version>2.1.1.RELEASE</version>
          </dependency>

          application.properties文件中配置api的信息

          #配置swagger的api信息
          swagger.api.name = demo-api
          swagger.api.title=Demo API
          swagger.api.description=SwaggerSpringBootStarter 使用樣例,一切就是這么簡單
          swagger.api.version=2.1.1
          swagger.api.contact.name = 阿信sxq
          swagger.api.contact.email = [email protected]
          swagger.api.contact.url = https://my.oschina.net/songxinqiang/
          swagger.api.exclude-paths=/error,/admin/**

          其中忽略路徑使用英文逗號進行分隔,可以不進行配置

          swagger ui在使用時的配置

          api的控制器會監(jiān)聽在地址/v2/api-docs?group=<swagger.api.name配置的值>, 對于swagger ui來說需要指定服務器的“基礎地址”為項目的根地址即可

          需要單獨準備swagger ui

          可以使用maven坐標為

          <dependency>
              <groupId>cn.songxinqiang</groupId>
              <artifactId>swagger-spring-boot-starter-ui</artifactId>
              <version>2.1.1.RELEASE</version>
          </dependency>

          的webjar

          使用演示

          說明博客: https://my.oschina.net/songxinqiang/blog/1490463

          使用演示可以查看 https://gitee.com/songxinqiang/SpringBootSwaggerStarter-Demo

          瀏覽 20
          點贊
          評論
          收藏
          分享

          手機掃一掃分享

          編輯 分享
          舉報
          評論
          圖片
          表情
          推薦
          點贊
          評論
          收藏
          分享

          手機掃一掃分享

          編輯 分享
          舉報
          <kbd id="afajh"><form id="afajh"></form></kbd>
          <strong id="afajh"><dl id="afajh"></dl></strong>
            <del id="afajh"><form id="afajh"></form></del>
                1. <th id="afajh"><progress id="afajh"></progress></th>
                  <b id="afajh"><abbr id="afajh"></abbr></b>
                  <th id="afajh"><progress id="afajh"></progress></th>
                  超碰在线大香蕉 172.86.93.25 | 天天干视频在线91 | 欧美日韩中文字幕在线视频 | 干骚逼视频 | 成人伊人综合网 |