spring整合swagger报错NoSuchMethodError: org.springframework.web.util.UriComponentsBuilder.fromHttpRequest

@参考博客

java.lang.NoSuchMethodError: org.springframework.web.util.UriComponentsBuilder.fromHttpRequest(Lorg/springframework/http/HttpRequest;)Lorg/springframework/web/util/UriComponentsBuilder;
at springfox.documentation.swagger2.web.HostNamePr

原因:原因是spring-web版本不配对swagger2,UriComponentsBuilder内部方法找不到

解决办法:io.springfox俩个包若是2.7.0的版本,spring-web包的版本至少要4.1.6。搭配使用,要么spring整体升级版本,要么swagger降版本。

原文地址:https://www.cnblogs.com/yanan7890/p/12843566.html