spring boot整合swagger2之一个大坑的自白

1、第一弹,报错内容

***************************
APPLICATION FAILED TO START
***************************

Description:

An attempt was made to call a method that does not exist. The attempt was made from the following location:

    springfox.documentation.spring.web.scanners.ApiListingScanner.scan(ApiListingScanner.java:117)

The following method did not exist:

    com.google.common.collect.FluentIterable.append(Ljava/lang/Iterable;)Lcom/google/common/collect/FluentIterable;

The method's class, com.google.common.collect.FluentIterable, is available from the following locations:

    jar:file:/Users/taoger/.m2/repository/com/google/guava/guava/16.0.1/guava-16.0.1.jar!/com/google/common/collect/FluentIterable.class

It was loaded from the following location:

    file:/Users/taoger/.m2/repository/com/google/guava/guava/16.0.1/guava-16.0.1.jar
Action:

Correct the classpath of your application so that it contains a single, compatible version of com.google.common.collect.FluentIterable

从如上报错可以看出,是jar包引的错误,(maven工程的痛,总是jar冲突),然后就开始度娘,各种尝试

有说zookeeper没有启动的,有说虚拟机防火墙没关闭的,各种吧,但是明显不是问题治所在啊,这TND就是jar冲突!!!

2、开始进行jar包冲突解决

spring boot整合swagger2之一个大坑的自白 在pom中进行jar的extentions并进行新jar包的引入,(大声喊出来,你们是不是也搜到了这个方法!!!没用的弟弟们,还是不行,依旧是这个错)

3、进行sts中pom的Dependency Hierarchy 排查

spring boot整合swagger2之一个大坑的自白

spring boot整合swagger2之一个大坑的自白

将右侧必须依赖的jar包引入

spring boot整合swagger2之一个大坑的自白

重启,好了~~

xiba,不应该啊

我饮用了三方插件啊

spring boot整合swagger2之一个大坑的自白按理说这个插件应把springfox-swagger2会引进来的,但是就是不行!!

4、不死心系列之替换最直接的报错问题guava的版本

spring boot整合swagger2之一个大坑的自白spring boot整合swagger2之一个大坑的自白

然后DT的是,不行!弟弟,不行啊,不知道底层原理就是这么茫然所措,还是乖乖根据第3步操作吧

至此,不折腾配置就这么陪玩了

看一下效果吧

spring boot整合swagger2之一个大坑的自白

捣鼓了一天

就这