Eureka
服务端配置
pom配置文件
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
</dependency>
基础配置项
# 服务名称
spring.application.name=poul-eureka-server
# 设置服务端口号
server.port = 7070
# 取消自动注册
eureka.client.register-with-eureka=false
# 取消扫描发现
eureka.client.fetch-registry=false
#配置客户端默认访问地址
eureka.client.service-url.defaultZone = http://localhost:${server.port}/eureka
#配置访问路径
management.endpoints.web.exposure.include=*
启动注解
@EnableEurekaServer
客户端配置
pom配置文件
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>
基础配置项
#服务端注册地址
eureka.client.service-url.defaultZone=\
http://localhost:${eureka.client.proxy-port}/eureka
启动注解
@EnableDiscoveryClient