【SpringBoot报错】org.springframework.context.ApplicationContextException: Failed to start bean ‘documen

报错信息:org.springframework.context.ApplicationContextException: Failed to start bean 'documentationPluginsBootstrapper'; nested exception is java.lang.NullPointerException

【SpringBoot报错】org.springframework.context.ApplicationContextException: Failed to start bean ‘documen_第1张图片

原因:springboot2.6.x版本与swagger2版本不兼容

【SpringBoot报错】org.springframework.context.ApplicationContextException: Failed to start bean ‘documen_第2张图片

【SpringBoot报错】org.springframework.context.ApplicationContextException: Failed to start bean ‘documen_第3张图片

解决方法:
在application.yml中配置
spring:
  mvc:
    pathmatch:
      matching-strategy: ant-path-matcher #2.6版本Spring MVC 处理映射匹配的默认策略已从AntPathMatcher更改为PathPatternParser
      
或在application.properties中配置
# 处理SpringBoot2.6.x与Swagger2 版本冲突
spring.mvc.pathmatch.matching-strategy=ant_path_matcher

你可能感兴趣的:(Springboot,spring,boot,后端,java)