依赖
<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/
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。