Created
August 31, 2018 07:52
-
-
Save AravindaM/aef889cb4a1de9cfb425beec8a0190d3 to your computer and use it in GitHub Desktop.
Add custom health indicator to spring boot actuators
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
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