File tree 13 files changed +193
-5
lines changed
lab-04/lab-04-rabbitmq-demo-orderly/target
java/cn/iocoder/springboot/lab34/actuatordemo
lab-34-actuator-demo-health
java/cn/iocoder/springboot/lab34/actuatordemo
13 files changed +193
-5
lines changed Original file line number Diff line number Diff line change 37
37
38
38
* [ 《芋道 Spring Boot 安全框架 Spring Security 入门》] ( http://www.iocoder.cn/Spring-Boot/Spring-Security/?github ) 对应 [ lab-01] ( https://github.com/YunaiV/SpringBoot-Labs/tree/master/lab-01 ) 。
39
39
* [ 《芋道 Spring Boot 授权框架 Spring Security OAuth2 入门》] ( http://www.iocoder.cn/Spring-Security/OAuth2-learning/?github ) 对应 [ lab-02] ( https://github.com/YunaiV/SpringBoot-Labs/tree/master/lab-02 ) 。
40
- * 《芋道 Spring Boot Shiro 入门》计划中...
40
+ * [ 《芋道 Spring Boot 安全框架 Shiro 入门》] ( http://www.iocoder.cn/Spring-Boot/Shiro/?github ) 对应 [ lab-33 ] ( https://github.com/YunaiV/SpringBoot-Labs/tree/master/lab-33 ) 。
41
41
42
42
## 定时任务与异步任务
43
43
51
51
* [ 《芋道 Spring Boot 消息队列 RabbitMQ 入门》] ( http://www.iocoder.cn/Spring-Boot/RabbitMQ/?github ) 对应 [ lab-04] ( https://github.com/YunaiV/SpringBoot-Labs/tree/master/lab-04 ) 。
52
52
* [ 《芋道 Spring Boot 消息队列 ActiveMQ 入门》] ( http://www.iocoder.cn/Spring-Boot/ActiveMQ/?github ) 对应 [ lab-32] ( https://github.com/YunaiV/SpringBoot-Labs/tree/master/lab-32 ) 。
53
53
54
+ ## 监控管理
55
+
56
+
57
+
54
58
## 性能测试
55
59
56
60
* [ 《性能测试 —— Tomcat、Jetty、Undertow 基准测试》] ( http://www.iocoder.cn/Performance-Testing/Tomcat-Jetty-Undertow-benchmark/?github ) 对应 [ lab-05] ( https://github.com/YunaiV/SpringBoot-Labs/tree/master/lab-05 ) 。
65
69
66
70
如下是草稿目录,未来需要整理下
67
71
68
- # lab-01
69
-
70
- 空
71
-
72
72
# lab-05
73
73
74
74
TODO
Original file line number Diff line number Diff line change
1
+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2
+ <project xmlns =" http://maven.apache.org/POM/4.0.0"
3
+ xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
4
+ xsi : schemaLocation =" http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" >
5
+ <parent >
6
+ <groupId >org.springframework.boot</groupId >
7
+ <artifactId >spring-boot-starter-parent</artifactId >
8
+ <version >2.2.2.RELEASE</version >
9
+ <relativePath /> <!-- lookup parent from repository -->
10
+ </parent >
11
+ <modelVersion >4.0.0</modelVersion >
12
+
13
+ <artifactId >lab-34-actuator-demo-health</artifactId >
14
+
15
+ <dependencies >
16
+ <!-- 实现对 Spring MVC 的自动化配置 -->
17
+ <dependency >
18
+ <groupId >org.springframework.boot</groupId >
19
+ <artifactId >spring-boot-starter-web</artifactId >
20
+ </dependency >
21
+
22
+ <!-- 实现对 Actuator 的自动化配置 -->
23
+ <dependency >
24
+ <groupId >org.springframework.boot</groupId >
25
+ <artifactId >spring-boot-starter-actuator</artifactId >
26
+ </dependency >
27
+ </dependencies >
28
+
29
+ </project >
Original file line number Diff line number Diff line change
1
+ package cn .iocoder .springboot .lab34 .actuatordemo ;
2
+
3
+ import org .springframework .boot .SpringApplication ;
4
+ import org .springframework .boot .autoconfigure .SpringBootApplication ;
5
+
6
+ @ SpringBootApplication
7
+ public class Application {
8
+
9
+ public static void main (String [] args ) {
10
+ SpringApplication .run (Application .class , args );
11
+ }
12
+
13
+ }
Original file line number Diff line number Diff line change
1
+ package cn .iocoder .springboot .lab34 .actuatordemo .actuate ;
2
+
3
+ import org .springframework .boot .actuate .health .AbstractHealthIndicator ;
4
+ import org .springframework .boot .actuate .health .Health ;
5
+ import org .springframework .stereotype .Component ;
6
+
7
+ @ Component
8
+ public class DemoHealthIndicator extends AbstractHealthIndicator {
9
+
10
+ @ Override
11
+ protected void doHealthCheck (Health .Builder builder ) {
12
+ // 较差是否健康
13
+ boolean success = checkSuccess ();
14
+
15
+ // 如果健康,则标记状态为 UP
16
+ if (success ) {
17
+ builder .up ().build ();
18
+ return ;
19
+ }
20
+
21
+ // 如果不健康,则标记状态为 DOWN
22
+ builder .down ().withDetail ("msg" , "我就是做个示例而已" );
23
+ }
24
+
25
+ private boolean checkSuccess () {
26
+ return false ;
27
+ }
28
+
29
+ }
Original file line number Diff line number Diff line change
1
+ management :
2
+ endpoint :
3
+ # Health 端点配置项,对应 HealthProperties 配置类
4
+ health :
5
+ enabled : true # 是否开启。默认为 true 开启。
6
+ show-details : ALWAYS # 何时显示完整的健康信息。默认为 NEVER 都不展示。可选 WHEN_AUTHORIZED 当经过授权的用户;可选 ALWAYS 总是展示。
7
+ status :
8
+ http-mapping : # 设置不同健康状态对应的响应状态码
9
+ DOWN : 403
10
+ health :
11
+ # DiskSpaceHealthIndicator 配置项,对应 DiskSpaceHealthIndicatorProperties
12
+ diskspace :
13
+ enabled : true # 是否开启。默认为 true 开启。
14
+ path : . # 目录。默认为 . 当前目录。
15
+ threshold : # 剩余空间的阀值。默认为 10M 。
16
+ endpoints :
17
+ # Actuator HTTP 配置项,对应 WebEndpointProperties 配置类
18
+ web :
19
+ base-path : /actuator # Actuator 提供的 API 接口的根目录。默认为 /actuator
20
+ exposure :
21
+ include : ' *' # 需要开放的端点。默认值只打开 health 和 info 两个端点。通过设置 * ,可以开放所有端点。
22
+ exclude : # 在 include 的基础上,需要排除的端点。通过设置 * ,可以排除所有端点。
23
+
Original file line number Diff line number Diff line change
1
+ management :
2
+ endpoint :
3
+ # Health 端点配置项,对应 HealthProperties 配置类
4
+ health :
5
+ enabled : true # 是否开启。默认为 true 开启。
6
+ show-details : ALWAYS # 何时显示完整的健康信息。默认为 NEVER 都不展示。可选 WHEN_AUTHORIZED 当经过授权的用户;可选 ALWAYS 总是展示。
7
+ status :
8
+ http-mapping : # 设置不同健康状态对应的响应状态码
9
+ DOWN : 403
10
+ health :
11
+ # DiskSpaceHealthIndicator 配置项,对应 DiskSpaceHealthIndicatorProperties
12
+ diskspace :
13
+ enabled : true # 是否开启。默认为 true 开启。
14
+ path : . # 目录。默认为 . 当前目录。
15
+ threshold : # 剩余空间的阀值。默认为 10M 。
16
+ endpoints :
17
+ # Actuator HTTP 配置项,对应 WebEndpointProperties 配置类
18
+ web :
19
+ base-path : /actuator # Actuator 提供的 API 接口的根目录。默认为 /actuator
20
+ exposure :
21
+ include : ' *' # 需要开放的端点。默认值只打开 health 和 info 两个端点。通过设置 * ,可以开放所有端点。
22
+ exclude : # 在 include 的基础上,需要排除的端点。通过设置 * ,可以排除所有端点。
23
+
Original file line number Diff line number Diff line change
1
+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2
+ <project xmlns =" http://maven.apache.org/POM/4.0.0"
3
+ xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
4
+ xsi : schemaLocation =" http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" >
5
+ <parent >
6
+ <groupId >org.springframework.boot</groupId >
7
+ <artifactId >spring-boot-starter-parent</artifactId >
8
+ <version >2.2.2.RELEASE</version >
9
+ <relativePath /> <!-- lookup parent from repository -->
10
+ </parent >
11
+ <modelVersion >4.0.0</modelVersion >
12
+
13
+ <artifactId >lab-34-acturator-demo</artifactId >
14
+
15
+ <dependencies >
16
+ <!-- 实现对 Spring MVC 的自动化配置 -->
17
+ <dependency >
18
+ <groupId >org.springframework.boot</groupId >
19
+ <artifactId >spring-boot-starter-web</artifactId >
20
+ </dependency >
21
+
22
+ <!-- 实现对 Actuator 的自动化配置 -->
23
+ <dependency >
24
+ <groupId >org.springframework.boot</groupId >
25
+ <artifactId >spring-boot-starter-actuator</artifactId >
26
+ </dependency >
27
+ </dependencies >
28
+
29
+ </project >
Original file line number Diff line number Diff line change
1
+ package cn .iocoder .springboot .lab34 .actuatordemo ;
2
+
3
+ import org .springframework .boot .SpringApplication ;
4
+ import org .springframework .boot .autoconfigure .SpringBootApplication ;
5
+
6
+ @ SpringBootApplication
7
+ public class Application {
8
+
9
+ public static void main (String [] args ) {
10
+ SpringApplication .run (Application .class , args );
11
+ }
12
+
13
+ }
Original file line number Diff line number Diff line change
1
+ management :
2
+ endpoints :
3
+ # Actuator HTTP 配置项,对应 WebEndpointProperties 配置类
4
+ web :
5
+ base-path : /actuator # Actuator 提供的 API 接口的根目录。默认为 /actuator
6
+ exposure :
7
+ include : ' *' # 需要开放的端点。默认值只打开 health 和 info 两个端点。通过设置 * ,可以开放所有端点。
8
+ exclude : # 在 include 的基础上,需要排除的端点。通过设置 * ,可以排除所有端点。
Original file line number Diff line number Diff line change
1
+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2
+ <project xmlns =" http://maven.apache.org/POM/4.0.0"
3
+ xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
4
+ xsi : schemaLocation =" http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" >
5
+ <parent >
6
+ <artifactId >labs-parent</artifactId >
7
+ <groupId >cn.iocoder.springboot.labs</groupId >
8
+ <version >1.0-SNAPSHOT</version >
9
+ </parent >
10
+ <modelVersion >4.0.0</modelVersion >
11
+
12
+ <artifactId >lab-34</artifactId >
13
+ <packaging >pom</packaging >
14
+ <modules >
15
+ <module >lab-34-actuator-demo</module >
16
+ <module >lab-34-actuator-demo-health</module >
17
+ </modules >
18
+
19
+
20
+ </project >
Original file line number Diff line number Diff line change 42
42
<module >lab-31</module >
43
43
<module >lab-32</module >
44
44
<module >lab-33</module >
45
+ <module >lab-34</module >
45
46
</modules >
46
47
47
48
You can’t perform that action at this time.
0 commit comments