一、问题背景
最近在尝试做一个springboot相关的练手项目,想尝试一下接口工具swagger,项目springboot版本为2.7.14,查到的对应swagger版本为3.0+,对应依赖如下:
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>3.0.0</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>3.0.0</version>
</dependency>
二、错误
正常配置swagger类,启动项目,报错如下:
Failed to start bean 'documentationPluginsBootstrapper';
三、解决
网上转了转,终于找到了解决方案:
1.swagger依赖版本过高,我这里换成了2.9.2
2.在swagger配置类的application.yml配置文件中添加如下内容:
spring:
mvc:
pathmatch:
matching-strategy: ant_path_matcher
随后正常启动: