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

限于喜欢 提交于 2020-05-08 17:20:38

@参考博客

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

 

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!