当我尝试运行 Springboot eureka 客户端时出现以下运行时异常
org.springframework.beans.factory.BeanDefinitionStoreException:无法加载 bean 类:;嵌套异常是 java.lang.IllegalStateException: Annotation @EnableDiscoveryClient found,但没有实现。你忘了包括一个开胃菜吗?
当我尝试运行 Springboot eureka 客户端时出现以下运行时异常
org.springframework.beans.factory.BeanDefinitionStoreException:无法加载 bean 类:;嵌套异常是 java.lang.IllegalStateException: Annotation @EnableDiscoveryClient found,但没有实现。你忘了包括一个开胃菜吗?
您应该添加以下起始 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>