목차

Spring Boot Actuator

모든 Actuator 켜기 / 끄기

management.security.enabled=false # 전체 다 활성화
management.server.port=8081 
management.server.address=127.0.0.1

management.server.port=-1 # http endpoint 끄기

Health Check

import org.springframework.boot.actuate.health.Health;
import org.springframework.boot.actuate.health.HealthIndicator;
import org.springframework.stereotype.Component;
 
@Component
public class MyHealthIndicator implements HealthIndicator {
 
	@Override
	public Health health() {
		int errorCode = check(); // perform some specific health check
		if (errorCode != 0) {
			return Health.down().withDetail("Error Code", errorCode).build();
		}
		return Health.up().build();
	}
 
}

참조