搭建Eureka服务时报错,报错信息如下:
报错原因是由于springboot的版本和springcloud版本不匹配,可以通过下面的博客查询springboot和springCloud的对应版本。
SpringBoot与SpringCloud对应版本及官方查询方法_springboot springcloud版本对应-CSDN博客
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>Hoxton.SR10</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Hoxton对应的Springboot版本是2.2.x, 2.3.x,项目引用的Springboot版本是2.7.7,版本不匹配,通过查询得知2021.0.x对应的Springboot版本是2.6.x, 2.7.x,将上面的代码改为
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>2021.0.3</version>
<type>pom</type>
<scope>import</scope>
</dependency>
重启idea后再次运行,运行成功。