Eureka 是 spring cloud 微服务的注册中心,搭建并启动eureka的过程是:
1.创建一个maven工程
2. 删除 工程中的src文件夹
3.新建一个spring initializer子模块
4. 添加@EnableEurekaServer注解
5.添加端口号,打开application.properties,添加如下内容
server.port=8089
spring.application.name=register-server
eureka.instance.hostname=localhost
eureka.client.service-url.defaultZone=http://${eureka.instance.hostname}:${server.port}/eureka/
eureka.client.fetch-registry=false
eureka.client.register-with-eureka=false
6.在EurekacenterApplication文件上右键,点击run
7.地址栏输入http://localhost:8089/,出现如下界面表示启动成功