Maven项目启动报错
[o.s.b.c.e.AnnotationConfigEmbeddedWebApplicationContext] WARN - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'requestMappingHandlerAdapter' defined in class path resource [org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]: Initialization of bean failed; nested exception is java.lang.NoSuchMethodError: com.google.common.collect.Lists.reverse(Ljava/util/List;)Ljava/util/List;
根据方法名com.google.common.collect.Lists.reverse搜了一下,在com.google.guava包里找到这个方法,这就让我很困惑,然后百度了一波,说在com.google.collections:google-collection中有一个同目录同class,但是没有reverse方法,看了下项目,果然引入了这个jar包.
但不记得有引入过这个jar,用mvn dependency:tree -Dincludes=com.google.collections:google-collection搜了一下,发现是
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
</dependency>
中的,注释掉之后启动成功