SpringBoot3使用Swagger


项目中的后端接口进行简单的前端展示

Swagger是一个用于设计、构建、文档化和使用RESTful Web服务的开源工具。Swagger3是Swagger的最新版本,它提供了许多新功能和改进。

Swagger在SpringBoot3中的引入方法发生了改变,网上大部分还是SpringBoot2的版本

springboot版本3.2.4

一、依赖引入

用maven构建一个SpringBoot3的项目,在依赖中引入,在pom.xml中添加

<dependency>
            <groupId>org.springdoc</groupId>
            <artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
            <version>2.0.4</version>
</dependency>

版本也可以使用新版,Springdoc-OpenAPI网站链接

二、快速启动

1.在application.yml中配置

# swagger-ui custom path
springdoc:
  swagger-ui:
    path : /swagger-ui.html

2.或者properties文件,则配置

代码如下(示例):

# swagger-ui custom path
springdoc.swagger-ui.path=/swagger-ui.html

3.启动项目访问swagger

访问http://localhost:9090/swagger-ui/index.html#/
其中的9090 改成你项目后端使用的端口,注意不能省略后面的index.html

相关推荐

  1. SpringBoot3使用Swagger

    2024-06-18 07:26:06       8 阅读
  2. springboot3整合swagger

    2024-06-18 07:26:06       31 阅读
  3. SpringBoot集成Swagger3.0

    2024-06-18 07:26:06       22 阅读
  4. SpringBoot 3.0 升级之 Swagger 升级

    2024-06-18 07:26:06       35 阅读
  5. Springboot3 集成knife4j(swagger)

    2024-06-18 07:26:06       16 阅读

最近更新

  1. TCP协议是安全的吗?

    2024-06-18 07:26:06       19 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2024-06-18 07:26:06       19 阅读
  3. 【Python教程】压缩PDF文件大小

    2024-06-18 07:26:06       19 阅读
  4. 通过文章id递归查询所有评论(xml)

    2024-06-18 07:26:06       20 阅读

热门阅读

  1. Mybatis 的缓存功能

    2024-06-18 07:26:06       4 阅读
  2. Flask-RESTPlus

    2024-06-18 07:26:06       5 阅读
  3. XML 编辑器:功能、选择与使用技巧

    2024-06-18 07:26:06       7 阅读
  4. 如何通俗理解逻辑回归(Logistic Regression)

    2024-06-18 07:26:06       7 阅读
  5. 【神经网络】深度神经网络如何应用于推荐系统

    2024-06-18 07:26:06       6 阅读
  6. TransformerConv

    2024-06-18 07:26:06       5 阅读
  7. 网络安全筑基篇——文件上传

    2024-06-18 07:26:06       8 阅读
  8. c++日期类的实现

    2024-06-18 07:26:06       6 阅读
  9. 计算机组成原理-期末考前常见简答题总结

    2024-06-18 07:26:06       8 阅读
  10. TensorFlow音频分类修复

    2024-06-18 07:26:06       6 阅读
  11. 在历史课堂教学过程中培养学生的计算思维能力

    2024-06-18 07:26:06       7 阅读