zoukankan      html  css  js  c++  java
  • SpringBoot集成Swagger3.0使用

    SpringBoot集成Swagger3.0使用

    一、pom文件导入依赖

    <dependency>
        <groupId>io.springfox</groupId>
        <artifactId>springfox-boot-starter</artifactId>
        <version>3.0.0</version>
    <dependency>

    二、启动文件添加@EnableOpenApi

    @EnableOpenApi
    @SpringBootApplication
    public class DemoApplication {
     
        public static void main(String[] args) {
            SpringApplication.run(DemoApplication.class, args);
        }
     
    }

    三、启动访问路径:http://localhost:9001/swagger-ui/index.html

    备注:端口不一定要和我一样

    注意点

    这次更新,移除了原来默认的swagger页面路径:http://host/context-path/swagger-ui.html,

    新增了两个可访问路径:

    1. http://host/context-path/swagger-ui/index.html
    2. http://host/context-path/swagger-ui/

    通过调整日志级别,还可以看到新版本的swagger文档接口也有新增,除了以前老版本的文档接口/v2/api-docs之外,还多了一个新版本的/v3/api-docs接口。

  • 相关阅读:
    面向对象高级
    面向对象进阶
    python文件的两种用途
    python常用模块
    模块的搜索路径
    循环导入问题
    模块的导入
    面向过程编程
    函数及嵌套函数调用
    python文件操作详解
  • 原文地址:https://www.cnblogs.com/zhanqing/p/swagger3.html
Copyright © 2011-2022 走看看