work hard work smart

专注于Java后端开发。 不断总结,举一反三。
  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

Eureka Client的使用

Posted on 2018-11-15 14:31  work hard work smart  阅读(1469)  评论(0编辑  收藏  举报

1. 新建工程

下一步,名字叫client

选择Cloud Discovery->Eureka Discovery

下一步后,点击完成

 

2. 在ClientApplication文件中增加EnableDiscoveryClient注解

 

 

 启动程序

发现如下错误:

Destroy method on bean with name 'scopedTarget.eurekaClient' BeanCreationNotAllowedException: Error creating bean with name 'eurekaInstanceConfigBean': Singleton bean creation not allowed while singletons of this factory are in destruction

解决方法:

在pom.xml中增加

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


3. application.yml配置

配置往哪个地址注册: defaultZone: http://localhost:8761/eureka/