如何出现这个报错,我想将一个 boot 项目注册到 Eureka 上
添加了依赖
<dependency>
<groupId></groupId>
<artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
<version>2.0.</version>
</dependency>
配置文件参数
eureka:
client:
service-url:
defaultZone: http://192.168.1.9:18000/eureka/
enabled: true
instance:
prefer-ip-address: true
instance-id: ${}:${}}
lease-renewal-interval-in-seconds: 10
lease-expiration-duration-in-seconds: 30
添加 @EnableEurekaClient 注解
报错信息
经过排查发现 spring cloud 的版本没有配置,添加以下版本管理配置
<properties>
<>Finchley.SR2</>
<>2.1.</>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId></groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>${}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId></groupId>
<artifactId>platform-bom</artifactId>
<version>${}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId></groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
OK! 启动成功