环境:springcloud F版本+maven工程

注册中心正常,创建普通的client项目,向注册中心注册,启动项目失败。

解决控制台警告错误信息:

Invocation of destroy method failed on bean with name 'scopedTarget.eurekaClient': org.springframework.beans.factory.BeanCreationNotAllowedException: Error creating bean with name 'eurekaInstanceConfigBean': Singleton bean creation not allowed while singletons of this factory are in destruction (Do not request a bean from a BeanFactory in a destroy method implementation!)

 

首先检查pom文件是否有:

<dependency>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-starter-web</artifactId>
</dependency>

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

然后检查启动类是否添加了

@EnableDiscoveryClient

注解。

Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐