eureka_client
环境版本
spring cloud Greenwich.SR5
spring boot 2.1.6.RELEASE
jdk 11
pom 文件
<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>
项目 配置文件
server:
port: 8030
spring:
application:
# 注册到eureka server的服务名# 注册到eureka server的服务名
name: order
eureka:
client:
serviceUrl:
# eureka server的地址
defaultZone: http://eureka0:8010/eureka/, http://eureka1:8010/eureka/, http://eureka2:8010/eureka/
启动类添加注解
@EnableEurekaClient
@SpringBootApplication
public class OrderApplication {
public static void main(String[] args) {
SpringApplication.run(OrderApplication.class, args);
}
}
网友评论