标签:code star cti ota 表示 netflix div static cal
SpringCloud 的服务注册和发现是由Eureka来完成。
<dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-netflix-eureka-server</artifactId> </dependency>
@SpringBootApplication @EnableEurekaServer //开启服务注册中心 public class EurekaServerApplication { public static void main(String[] args) { SpringApplication.run(EurekaServerApplication.class, args); } }
server: port: 8761 eureka: instance: hostname: localhost client: # 表示本应用是否是向注册中心注册自己 register-with-eureka: false # 是否检索服务 fetch-registry: false
<dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId> </dependency>
@SpringBootApplication @EnableDiscoveryClient public class EurekaClientApplication { public static void main(String[] args) { SpringApplication.run(EurekaClientApplication.class, args); } }
eureka: client: service-url: defaultZone: http://localhost:8761/eureka/
# 客户端名称 instance: hostname: client-1 spring: application:
# 注册到服务端名称 name: eureka-client
# 客户端端口 server: port: 8081
标签:code star cti ota 表示 netflix div static cal
原文地址:https://www.cnblogs.com/appleat/p/9983800.html