博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

swagger2搭配2.6版本springboot报错

Posted on 2022-03-14 19:52  青春猪头不会梦到Java  阅读(381)  评论(0)    收藏  举报

配置swagger时出现

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

解决方法:

  • 1:需要在启动类上添加@EnableWebMvc,但会导致swagger页面访问不了
  • 2:似乎spring boot2.6版本使用任何swagger都会报错降低spring boot版本到2.5.
  • 3:添加spring.mvc.pathmatch.matching-strategy=ant_path_matcher在配置文件中,解决问题