Eureka Client的使用

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/ 

猜你喜欢

转载自www.cnblogs.com/linlf03/p/9963246.html