package cn.reghao.tnb.sb.config;

import org.springframework.boot.actuate.health.AbstractHealthIndicator;
import org.springframework.boot.actuate.health.Health;
import org.springframework.stereotype.Component;

/**
 * @author reghao
 * @date 2025-07-15 09:51:12
 */
@Component
public class CustomHealthIndicator extends AbstractHealthIndicator {
    @Override
    protected void doHealthCheck(Health.Builder builder) throws Exception {
        // 使用 builder 来创建健康状态信息
        // 如果 throw 一个 exception，那么 status 就会被置为 DOWN，异常信息会被记录
        builder.up()
                .withDetail("app", "health")
                .withDetail("error", "Nothing, looks good");
    }
}
