Cannot invoke “org.springframework.web.servlet.mvc.condition.PatternsRequestCondition.getPatterns()“

异常信息:

Cannot invoke “org.springframework.web.servlet.mvc.condition.PatternsRequestCondition.getPatterns()” because “this.condition” is null

出现该异常的环境:
springboot 2.6.8 + springfox 3.0.0

通过在网上翻博客查资料发现出现异常的原因主要在于springfox3.0.0

解决办法:
因为我是在springboot+rabbitmq的时候出现的,所以在maven中添加了

<dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
</dependency>

所以不能通过解决spring2.6+swagger2那样解决,只需要换一个springboot的版本就好了(版本需要在springboot2.6.x以下)

如果没有引入actuator依赖,就可以向解决spring2.6+swagger2那样在application配置文件中添加以下配置就好了:

spring:
    mvc:
    pathmatch:
      matching-strategy: ant_path_matcher
posted @ 2022-12-13 15:23  just1t  阅读(2610)  评论(0)    收藏  举报