forked from yudaocode/SpringBoot-Labs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
YunaiV
committed
Dec 20, 2019
1 parent
66ec3e1
commit c5fd04b
Showing
13 changed files
with
193 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file removed
BIN
-16 Bytes
...bitmq-demo-orderly/target/classes/META-INF/lab-04-rabbitmq-demo-concurrency.kotlin_module
Binary file not shown.
Binary file removed
BIN
-16 Bytes
...-demo-orderly/target/test-classes/META-INF/lab-04-rabbitmq-demo-concurrency.kotlin_module
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<parent> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-parent</artifactId> | ||
<version>2.2.2.RELEASE</version> | ||
<relativePath/> <!-- lookup parent from repository --> | ||
</parent> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<artifactId>lab-34-actuator-demo-health</artifactId> | ||
|
||
<dependencies> | ||
<!-- 实现对 Spring MVC 的自动化配置 --> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-web</artifactId> | ||
</dependency> | ||
|
||
<!-- 实现对 Actuator 的自动化配置 --> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-actuator</artifactId> | ||
</dependency> | ||
</dependencies> | ||
|
||
</project> |
13 changes: 13 additions & 0 deletions
13
...uator-demo-health/src/main/java/cn/iocoder/springboot/lab34/actuatordemo/Application.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package cn.iocoder.springboot.lab34.actuatordemo; | ||
|
||
import org.springframework.boot.SpringApplication; | ||
import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
|
||
@SpringBootApplication | ||
public class Application { | ||
|
||
public static void main(String[] args) { | ||
SpringApplication.run(Application.class, args); | ||
} | ||
|
||
} |
29 changes: 29 additions & 0 deletions
29
...h/src/main/java/cn/iocoder/springboot/lab34/actuatordemo/actuate/DemoHealthIndicator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package cn.iocoder.springboot.lab34.actuatordemo.actuate; | ||
|
||
import org.springframework.boot.actuate.health.AbstractHealthIndicator; | ||
import org.springframework.boot.actuate.health.Health; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
public class DemoHealthIndicator extends AbstractHealthIndicator { | ||
|
||
@Override | ||
protected void doHealthCheck(Health.Builder builder) { | ||
// 较差是否健康 | ||
boolean success = checkSuccess(); | ||
|
||
// 如果健康,则标记状态为 UP | ||
if (success) { | ||
builder.up().build(); | ||
return; | ||
} | ||
|
||
// 如果不健康,则标记状态为 DOWN | ||
builder.down().withDetail("msg", "我就是做个示例而已"); | ||
} | ||
|
||
private boolean checkSuccess() { | ||
return false; | ||
} | ||
|
||
} |
23 changes: 23 additions & 0 deletions
23
lab-34/lab-34-actuator-demo-health/src/main/resources/application.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
management: | ||
endpoint: | ||
# Health 端点配置项,对应 HealthProperties 配置类 | ||
health: | ||
enabled: true # 是否开启。默认为 true 开启。 | ||
show-details: ALWAYS # 何时显示完整的健康信息。默认为 NEVER 都不展示。可选 WHEN_AUTHORIZED 当经过授权的用户;可选 ALWAYS 总是展示。 | ||
status: | ||
http-mapping: # 设置不同健康状态对应的响应状态码 | ||
DOWN: 403 | ||
health: | ||
# DiskSpaceHealthIndicator 配置项,对应 DiskSpaceHealthIndicatorProperties | ||
diskspace: | ||
enabled: true # 是否开启。默认为 true 开启。 | ||
path: . # 目录。默认为 . 当前目录。 | ||
threshold: # 剩余空间的阀值。默认为 10M 。 | ||
endpoints: | ||
# Actuator HTTP 配置项,对应 WebEndpointProperties 配置类 | ||
web: | ||
base-path: /actuator # Actuator 提供的 API 接口的根目录。默认为 /actuator | ||
exposure: | ||
include: '*' # 需要开放的端点。默认值只打开 health 和 info 两个端点。通过设置 * ,可以开放所有端点。 | ||
exclude: # 在 include 的基础上,需要排除的端点。通过设置 * ,可以排除所有端点。 | ||
|
23 changes: 23 additions & 0 deletions
23
lab-34/lab-34-actuator-demo-health/target/classes/application.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
management: | ||
endpoint: | ||
# Health 端点配置项,对应 HealthProperties 配置类 | ||
health: | ||
enabled: true # 是否开启。默认为 true 开启。 | ||
show-details: ALWAYS # 何时显示完整的健康信息。默认为 NEVER 都不展示。可选 WHEN_AUTHORIZED 当经过授权的用户;可选 ALWAYS 总是展示。 | ||
status: | ||
http-mapping: # 设置不同健康状态对应的响应状态码 | ||
DOWN: 403 | ||
health: | ||
# DiskSpaceHealthIndicator 配置项,对应 DiskSpaceHealthIndicatorProperties | ||
diskspace: | ||
enabled: true # 是否开启。默认为 true 开启。 | ||
path: . # 目录。默认为 . 当前目录。 | ||
threshold: # 剩余空间的阀值。默认为 10M 。 | ||
endpoints: | ||
# Actuator HTTP 配置项,对应 WebEndpointProperties 配置类 | ||
web: | ||
base-path: /actuator # Actuator 提供的 API 接口的根目录。默认为 /actuator | ||
exposure: | ||
include: '*' # 需要开放的端点。默认值只打开 health 和 info 两个端点。通过设置 * ,可以开放所有端点。 | ||
exclude: # 在 include 的基础上,需要排除的端点。通过设置 * ,可以排除所有端点。 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<parent> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-parent</artifactId> | ||
<version>2.2.2.RELEASE</version> | ||
<relativePath/> <!-- lookup parent from repository --> | ||
</parent> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<artifactId>lab-34-acturator-demo</artifactId> | ||
|
||
<dependencies> | ||
<!-- 实现对 Spring MVC 的自动化配置 --> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-web</artifactId> | ||
</dependency> | ||
|
||
<!-- 实现对 Actuator 的自动化配置 --> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-actuator</artifactId> | ||
</dependency> | ||
</dependencies> | ||
|
||
</project> |
13 changes: 13 additions & 0 deletions
13
...-34-actuator-demo/src/main/java/cn/iocoder/springboot/lab34/actuatordemo/Application.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package cn.iocoder.springboot.lab34.actuatordemo; | ||
|
||
import org.springframework.boot.SpringApplication; | ||
import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
|
||
@SpringBootApplication | ||
public class Application { | ||
|
||
public static void main(String[] args) { | ||
SpringApplication.run(Application.class, args); | ||
} | ||
|
||
} |
8 changes: 8 additions & 0 deletions
8
lab-34/lab-34-actuator-demo/src/main/resources/application.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
management: | ||
endpoints: | ||
# Actuator HTTP 配置项,对应 WebEndpointProperties 配置类 | ||
web: | ||
base-path: /actuator # Actuator 提供的 API 接口的根目录。默认为 /actuator | ||
exposure: | ||
include: '*' # 需要开放的端点。默认值只打开 health 和 info 两个端点。通过设置 * ,可以开放所有端点。 | ||
exclude: # 在 include 的基础上,需要排除的端点。通过设置 * ,可以排除所有端点。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<parent> | ||
<artifactId>labs-parent</artifactId> | ||
<groupId>cn.iocoder.springboot.labs</groupId> | ||
<version>1.0-SNAPSHOT</version> | ||
</parent> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<artifactId>lab-34</artifactId> | ||
<packaging>pom</packaging> | ||
<modules> | ||
<module>lab-34-actuator-demo</module> | ||
<module>lab-34-actuator-demo-health</module> | ||
</modules> | ||
|
||
|
||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters