# 10 独立微服务编写
# 10.1 目的
通过这个服务来看eureka注册中心的效果。
复习Spring Boot。
减少了大量配置。快速开发。
用Starter集成一个新框架。比如redis,web等。添加依赖,加配置文件。
嵌入式服务器,令开发和部署变的方便。
Spring Boot介绍:
https://docs.spring.io/spring-boot/docs/2.1.7.RELEASE/
1
2
2
# 10.2 业务介绍
查询app的版本更新。
《网约车乘客端PRD》中app更新。
# 10.3 服务定义
service-app-update
# 10.4 代码步骤
- pom.xml
- application.yml
- java代码
看代码。
# 10.5 测试
yapi工具介绍
# 10.6 监控端点
加入maven依赖
<!-- 监控端点 --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-actuator</artifactId> </dependency>
1
2
3
4
5查询端点信息。
http://localhost:8003/actuator/health
检查资源来判断应用程序是否正常。
UP,DOWN,OUT_OF_SERVICE,UNKNOWN
{
"status": "UP",
}
1
2
3
4
5
6
7
8
2
3
4
5
6
7
8
← 1 课程概述 11 服务注册与发现 →