1 问题描述
由于使用的swagger2与springboot版本不对应,如下引起了报错:
org.springframework.context.ApplicationContextException: Failed to start bean 'documentationPluginsBootstrapper'; nested exception is java.lang.NullPointerException
2 问题原因
在创建springboot工程时,选择版本过高,避免使用3.x.x版本,因版本不稳定。推荐使用2.7.13个人认为比较稳定。
3 解决方法
方法一
更改pom.xml文件中spring-boot-starter-parent版本,降至2.7.x版本或以下,可以适配swagger2的多种版本。
方法二
(2)在配置文件(.yml)中添加下边这行代码,再次运行成功。
# 解决springboot版本和swagger冲突问题
mvc:
pathmatch:
matching-strategy: ant_path_matcher