美文网首页
Failed to start bean 'documentat

Failed to start bean 'documentat

作者: 谁在烽烟彼岸 | 来源:发表于2022-06-14 10:55 被阅读0次

使用Springboot2.7.0构建项目

    implementation 'mysql:mysql-connector-java'
    implementation 'com.alibaba:druid-spring-boot-starter:1.2.11'
    implementation 'com.baomidou:mybatis-plus-boot-starter:3.5.2'
    implementation 'org.springframework.boot:spring-boot-starter-web'
    implementation 'io.springfox:springfox-boot-starter:3.0.0'

之后发生异常


异常截图.png

发现是路径配置器报了一个NullPointerException,
经分析发现Springboot2.7.0使用的是RouteMatcher,是实现类为PathPatternRouteMatcher,而在Springboot2.6.X之前使用的都是PathMatcher, 实现类为AntPathMatcher

RouteMatcher.png
而springfox使用的依旧是PathMatcher, 导致在启动时,无法获取AntPathMatcher实例,而报出异常。
解决办法:在配置文件中指定配置器。
spring:
  mvc:
    pathmatch:
      matching-strategy: ant_path_matcher

相关文章

网友评论

      本文标题:Failed to start bean 'documentat

      本文链接:https://www.haomeiwen.com/subject/yxfzmrtx.html