springboot 集成Swagger2报错 Failed to start bean ‘documentationPluginsBootstrapper’; nested exception is

springboot 集成Swagger2报错 Failed to start bean ‘documentationPluginsBootstrapper’; nested exception is java.lang.NullPointerException

原因:因为Springfox使用的路径匹配是基于AntPathMatcher的,
而Spring Boot 2.6.X使用的是PathPatternMatcher。

方法1:

修改application.yml 
spring: 
	mvc: 
		pathmatch: 
			matching-strategy: ANT_PATH_MATCHER

方法2:

swagger2版本为2.9.2,springboot版本为2.6.2时
Springboot版本过高,降为2.5.6

var code = “c4947b71-5776-406a-a960-643c019da1ff”

posted @ 2022-10-12 18:03  日报初级开发工程师  阅读(15)  评论(0)    收藏  举报  来源