eureka-service 服务注册/发现中心
复制必备
- pom.xml
- application.yml
- EurekaServiceApplication.java中@EnableEurekaServer
airport-service 机场服务(通过Spring Eureka注册服务)
复制必备
- pom.xml
- application.yml
- AirportServiceApplication.java中@EnableEurekaClient
查看结果
前置条件
- eureka-service启动后至少1分钟
- airport-service启动后观察eureka-service接收到3次心跳
查看方法
- 格式 http://:8761/eureka/apps/
- 示例 http://localhost:8761/eureka/apps/airportservice
- 默认返回XML格式,返回JSON必须将HTTP的请求头Accept设置为application/json
aircraft-service 飞机服务(使用服务发现来查找服务)
复制必备
- pom.xml
- application.yml
- AircraftServiceApplication.java中getRestTemplate()
查看结果
http://localhost:8100/v1/aircraft/HangZhou/