微服务 spring cloud 将服务注册到注册中心 (eureka)
eureka_client环境版本spring cloudGreenwich.SR5spring boot2.1.6.RELEASEjdk11pom 文件<dependency><groupId>org.springframework.boot</groupId><artifactId>...
·
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);
}
}
NOTE: 博客内容供参考学习,如有问题请指正,虚心接纳
更多推荐
已为社区贡献2条内容
所有评论(0)