大部分我们按照别人的例子敲完代码,一运行就发现,各种错误频出,下面就介绍下我遇到的错误,供读者参考
Caused by: java.lang.ClassNotFoundException: org.springframework.boot.context.embedded.FilterRegistrationBean
这个错误是因为spring-boot版本升级,一些类的路径改变了,所以就报这个类找不到。比如我用的是1.5.3.RELEASE,那么配置spring-cloud-dependencies就需要用Dalston.SR1,如下
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>Dalston.SR1</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
从官网上得知从1.5.x后,spring-cloud-dependencies版本就更新到Dalston.SR1和目前的Dalston.SR2,具体见 http://projects.spring.io/spring-cloud/
image.png