一、遇到的问题


核心问题是Springboot启动不成功

有可能就是Swagger文档,Spring Boot 2.7+ 与Springfox3.0.0 版本报错或者Spring Boot接入springfox-swagger2遇到的问题

二、解决办法

引入依赖:



        <!--接口文档依赖-->
        <dependency>
            <groupId>com.github.xiaoymin</groupId>
            <artifactId>knife4j-spring-boot-starter</artifactId>
            <version>3.0.2</version>
        </dependency>

        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger2</artifactId>
            <version>3.0.0</version>
        </dependency>
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger-ui</artifactId>
            <version>3.0.0</version>
        </dependency>

        <!--接口文档依赖-->

然后SpringBoot配置文件添加配置(我的是application.yml):

spring:
  mvc:
    pathmatch:
      matching-strategy: ant_path_matcher

然后就可以解决了

详情请看:https://blog.csdn.net/wy990880/article/details/141299036?spm=1001.2014.3001.5501

有问题请加联系方式(免费帮忙解决):

Logo

汇聚全球AI编程工具,助力开发者即刻编程。

更多推荐