启动SpringBoot项目的时候控制台输出的log如下
1 | shell复制代码2020-11-20 18:52:26.864 WARN o.s.b.w.s.c.AnnotationConfigServletWebServerApplicationContext - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Failed to start bean 'documentationPluginsBootstrapper'; nested exception is com.google.common.util.concurrent.ExecutionError: java.lang.NoSuchMethodError: com.google.common.collect.FluentIterable.concat(Ljava/lang/Iterable;Ljava/lang/Iterable;)Lcom/google/common/collect/FluentIterable; |
根据以前解决错误的思路,往往都是看最后一个报错的日志,例如:
1 | shell复制代码but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread |
但是、我找了半天都没找到什么原因。还以为是我写的程序存在内存泄漏呢,就去用JVM相关的技术去排错,排了半天也没发现问题。
后来实在没办法了,就继续一步一步的往上翻看日志,找到了一句:
1 | shell复制代码 Failed to start bean 'documentationPluginsBootstrapper' |
去百度一搜,果然是这个的问题。
出现这个问题的原因就是:当前项目的guava版本与之不匹配
。
去查看了下项目里的guava的版本和swagger中的guava的版本:
果然是版本不同。
解决办法
修改成和swagger相同的guava版本即可:
1 | xml复制代码 <!-- <dependency> |
本文转载自: 掘金