springboot 2.6.0以上版本集成swagger时候,直接引入运行就会出现异常信息空指针。
主要原因是 springboot 2.6以上使用得默认路径匹配是PathPatternMatcher,而springfox使用得路径匹配是基于AntPathMathcher得。所以这里需要在配置文件中加入
spring.mvc.pathmatch.matching-strategy= ant_path_matcher
让swagger可以找到路径就不报空指针了。
springboot 2.6.0以上版本集成swagger时候,直接引入运行就会出现异常信息空指针。
主要原因是 springboot 2.6以上使用得默认路径匹配是PathPatternMatcher,而springfox使用得路径匹配是基于AntPathMathcher得。所以这里需要在配置文件中加入
spring.mvc.pathmatch.matching-strategy= ant_path_matcher
让swagger可以找到路径就不报空指针了。