打赏

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降版本。

 

posted @ 2020-05-07 15:54  每天都要学一点  阅读(964)  评论(0编辑  收藏  举报