<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
</dependencies>
启动类增加注解
@SpringBootApplication
@EnableEurekaClient
public class SpringWebDemoApplication {
public static void main(String[] args) {
SpringApplication.run(SpringWebDemoApplication.class, args);
}
}
配置文件
eureka.instance.appname=web-demo
eureka.instance.app-group-name=web
eureka.instance.prefer-ip-address=true
eureka.instance.ip-address=127.0.0.1
eureka.instance.instance-id= ${spring.application.name}:${server.port}
#eureka.instance.home-page-url-path=/
#eureka.instance.health-check-url-path=/health
#eureka.instance.status-page-url-path=/status
eureka.instance.lease-expiration-duration-in-seconds=30
eureka.instance.lease-renewal-interval-in-seconds=10
eureka.client.serviceUrl.defaultZone=http://localhost:19002/eureka/,http://localhost:19001/eureka/
原文地址:http://blog.51cto.com/881206524/2118309