天天看点

springCloud微服务 -EurekaServer

项目创建步骤:

idea-->spring--->cloud discovery --->Eureka Server 

在启动页上添加@EnableEurekaServer 

application中添加注册地址,注意单一情况下Server和Client都是自己

eureka.client.service-url:defaultZone:http://localhost:8080/eureka/

如下图:

eureka:
  client:
    service-url:
      defaultZone: http://localhost:8761/eureka/
    register-with-eureka: false
  server:
    enable-self-preservation: false
spring:
  application:
    name: eureka
server:
  port: 8761      
<parent>
   <groupId>org.springframework.boot</groupId>
   <artifactId>spring-boot-starter-parent</artifactId>
   <version>2.0.0.M3</version>
   <relativePath/> <!-- lookup parent from repository -->
</parent>

<properties>
   <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
   <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
   <java.version>1.8</java.version>
   <spring-cloud.version>Finchley.M2</spring-cloud.version>
   <product-common.version>0.0.1-SNAPSHOT</product-common.version>
</properties>