SpringBoot 2.6.x集成Swagger报错

发布时间 2023-07-31 16:46:22作者: 啊俊同学

SpringBoot 2.6.x集成Swagger报错

问题描述:使用SpringBoot集成Swagger后,运行报错:Failed to start bean ‘documentationPluginsBootstrapper’; nested exception is java.lang.NullPointerException

造成原因:这是因为springboot版本原因导致的,因为Springfox使用的路径匹配是基于AntPathMatcher的,而Spring Boot 2.6.X使用的是PathPatternMatcher。

解决方法:
降低springboot的版本,把springboot回退到2.5.6之前的就能正常启动

修改配置文件: