SpringBoot在整合Eureka时报错:
原因:
该启动异常是由于Spring Boot和Spring Cloud版本不相对应导致。
需要特别注意的使用Spring Boot和Spring Cloud进行开发时要求Spring Boot 的版本和 Spring Cloud 的版本相对应,如果版本不对应,会遇到很多报错的情况,他们的匹配关系如下:
Spring Cloud Hoxton --> Spring Boot 2.2.x
Spring Cloud Greenwich --> Spring Boot 2.1.x
Spring Cloud Finchley --> Spring Boot 2.0.x
Spring Cloud Edgware --> Spring Boot 1.5.x
我所使用的版本:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.6.RELEASE</version>
</parent>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>Greenwich.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
版本对应后成功运行: