-
概述
Eureka是一个注册中心,用来管理服务接口信息,消费者读取服务接口信息,服务提供者写入服务接口信息 -
环境搭建
a.导入依赖<groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.0.2.RELEASE</version> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-netflix-eureka-server</artifactId> </dependency>
b.编写application.yml
#设置eureka的服务端口 server: port: 9000 eureka: instance: #服务主机 hostname: 127.0.0.1 client: service-url: #连接到的注册中心地址 default-url: http://${eureka.instance.hostname}:${server.port}/eureka #是否需要注册当前服务 fetch-registry: false #是否需要检索服务接口信息 register-with-eureka: false
c.编写启动类
-
访问服务
(一)springloud之Eureka的使用
猜你喜欢
转载自blog.csdn.net/weixin_38312719/article/details/89407378
今日推荐
周排行