p9 Eureka-搭建eureka服务

1.在user-service项目引入spring-cloud-starter-netflix-eureka-client的依赖

    
        org.springframework.cloud
            spring-cloud-starter-netflix-eureka-server
        
    

 2.加入注解

@EnableEurekaServer
@SpringBootApplication
public class EurekaApplication {
    public static void main(String[] args) {
        SpringApplication.run(EurekaApplication.class,args);
    }
}

3.在application.yml文件,编写下面的配置:

server:
  port: 10086
spring:
  application:
    name: eurekaserver
eureka:
  client:
    service-url:
      defaultZone: http://127.0.0.1:10086/eureka/

你可能感兴趣的:(黑马微服务笔记,eureka,java,云原生)