Eureka Client服务开发

创建Spring Boot 项目

引入依赖

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

编写配置文件

server:
  port: 8081
spring:
  application:
    name: EUREKACLIENT
eureka:
  client:
    service-url:
      defaultZone: http://localhost:8761/eureka

启动类添加注解

@SpringBootApplication
@EnableEurekaClient
public class EurekaClientApplication {
    public static void main(String[] args) {
        SpringApplication.run(EurekaClientApplication.class,args);
    }
}
posted @ 2021-09-28 16:51  code-G  阅读(31)  评论(0编辑  收藏  举报