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);
    }

}

NOTE: 博客内容供参考学习,如有问题请指正,虚心接纳

Logo

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

更多推荐