Failed to start bean ‘documentationPluginsBootstrapper‘; nested exception is java.lang.NullPointerEx

springboot 集成Swagger2启动报错

Failed to start bean 'documentationPluginsBootstrapper'; nested exception is java.lang.NullPointerException

Caused by: java.lang.NullPointerException: null

原因分析:

Springboot2.6以后将SpringMVC 默认路径匹配策略从AntPathMatcher 更改为PathPatternParser,导致出错

解决方案:

在配置文件application.properties中加入以下配置

spring.mvc.pathmatch.matching-strategy=ANT_PATH_MATCHER

如果是application.yml就加入

# springboot 集成Swagger2
spring:
  mvc:
    pathmatch:
      matching-strategy: ant_path_matcher

猜你喜欢

转载自blog.csdn.net/weixin_46474921/article/details/129722635