Skip to content

Instantly share code, notes, and snippets.

@AravindaM
Created August 31, 2018 07:52
Show Gist options
  • Save AravindaM/aef889cb4a1de9cfb425beec8a0190d3 to your computer and use it in GitHub Desktop.
Save AravindaM/aef889cb4a1de9cfb425beec8a0190d3 to your computer and use it in GitHub Desktop.
Add custom health indicator to spring boot actuators
import org.springframework.boot.actuate.health.AbstractHealthIndicator;
import org.springframework.boot.actuate.health.Health;
import org.springframework.stereotype.Component;
@Component
public class AddCustomHealthIndicator extends AbstractHealthIndicator {
@Override
protected void doHealthCheck(Health.Builder builder) {
//Do health check
if (true) {
builder.up();
} else {
builder.down();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment