I want to display the following Health-Information:
{
"status":"UP",
"components": {
"myHealthComposite": {
"status":"UP",
"components": {
"myFirstHealthIndicator": { "status":"UP" },
"mySecondHealthIndicator": { "status":"UP" }
}
}
},
"groups":[]
}
From the latest Spring Boot Actuator Documentation I should implement "myFirstHealthIndactor" and "mySecondHealthIndicator" with the "HealthIndicator"-Interface and composite them with the "CompositeHealthContributor"-Interface. But for "CompositeHealthContributor" I need an excample and in the Documentation I can not found something usefull for me.
Can someone help me with that, please?
Greetings
Edit:
myFirstHealthIndicator
@Component
public class MyFirstHealthIndicator implements HealthIndicator {
@Override
public Health health() {
return Health.up().build();
}
}
mySecondHealthIndicator
@Component
public class MySecondHealthIndicator implements HealthIndicator {
@Override
public Health health() {
return Health.up().build();
}
}
myHealthComposite
@Component
public class MyHealthComposite implements CompositeHealthContributor {
@Override
public HealthContributor getContributor(String name) {
return null;
}
@Override
public Iterator<NamedContributor<HealthContributor>> iterator() {
return null;
}
}