Class KnoluxRedisHealthIndicator
java.lang.Object
com.knolux.redis.KnoluxRedisHealthIndicator
- All Implemented Interfaces:
org.springframework.boot.health.contributor.HealthContributor, org.springframework.boot.health.contributor.HealthIndicator
@Component
@ConditionalOnClass(org.springframework.boot.health.contributor.HealthIndicator.class)
public class KnoluxRedisHealthIndicator
extends Object
implements org.springframework.boot.health.contributor.HealthIndicator
Redis 健康狀態指標。
對 Redis 發送 PING 指令確認連線正常。
僅在 spring-boot-starter-actuator 存在於 classpath 時才會啟用。
健康端點範例回應(GET /actuator/health):
{
"status": "UP",
"components": {
"knoluxRedis": {
"status": "UP",
"details": { "ping": "PONG" }
}
}
}
-
Constructor Summary
ConstructorsConstructorDescriptionKnoluxRedisHealthIndicator(org.springframework.data.redis.core.StringRedisTemplate redis) -
Method Summary
Modifier and TypeMethodDescription@Nullable org.springframework.boot.health.contributor.Healthhealth()執行 Redis 健康檢查。Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.boot.health.contributor.HealthIndicator
health
-
Constructor Details
-
KnoluxRedisHealthIndicator
public KnoluxRedisHealthIndicator(org.springframework.data.redis.core.StringRedisTemplate redis)
-
-
Method Details
-
health
public @Nullable org.springframework.boot.health.contributor.Health health()執行 Redis 健康檢查。- Specified by:
healthin interfaceorg.springframework.boot.health.contributor.HealthIndicator- Returns:
- 健康狀態;PING 成功則為
UP(附ping: PONG), 否則為DOWN(附錯誤訊息)
-