Eureka Spring 引导客户端异常

Eureka Spring Boot client exception

当我尝试 运行 我的 Springboot eureka 客户端

时,我得到以下 运行 时间异常

org.springframework.beans.factory.BeanDefinitionStoreException: Failed to load bean class: ; nested exception is java.lang.IllegalStateException: Annotation @EnableDiscoveryClient found, but there are no implementations. Did you forget to include a starter?

您应该添加以下启动 POM 以获得所有必需的依赖项:

<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-eureka</artifactId>
</dependency>

不继承SpringBoot父POM时,在你的<dependencyManagement>中添加如下内容:

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-dependencies</artifactId>
    <version>${spring-boot.version}</version>
    <type>pom</type>
    <scope>import</scope>
</dependency>