美文网首页分布式
spring cloud 服务客户端-eureka_client

spring cloud 服务客户端-eureka_client

作者: yufw | 来源:发表于2020-04-09 19:27 被阅读0次

eureka_client

环境版本

spring cloud  Greenwich.SR5
spring boot   2.1.6.RELEASE
jdk           11

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>
        

项目 配置文件

server:
  port: 8030

spring:
  application:
    # 注册到eureka server的服务名# 注册到eureka server的服务名
    name: order 
eureka:
  client:
    serviceUrl:
      # eureka server的地址
      defaultZone: http://eureka0:8010/eureka/, http://eureka1:8010/eureka/, http://eureka2:8010/eureka/ 

启动类添加注解

@EnableEurekaClient
@SpringBootApplication
public class OrderApplication {

    public static void main(String[] args) {
        SpringApplication.run(OrderApplication.class, args);
    }

}

相关文章

网友评论

    本文标题:spring cloud 服务客户端-eureka_client

    本文链接:https://www.haomeiwen.com/subject/ztjhmhtx.html