I believe followed almost all tutorials on the Internet and read many SO answers and still I'm stuck.
1. A simple health check
@Component
public class HealthCheck implements HealthIndicator {
@Override
public Health health() {
return Health.up().build();
}
}
2. Application.yaml is configured to show all details:
management.endpoints.web.exposure.include: "*"
management.endpoint.health.show-details: ALWAYS
3. Spring-boot-actuator included as dependency:
implementation 'org.springframework.boot:spring-boot-starter-actuator'
implementation 'org.springframework.boot:spring-boot-starter-web'
4. Spring boot of recent release:
id 'org.springframework.boot' version '2.2.0.RELEASE'
5. Main application class is annotated with @SpringBootApplication
(which implicitly brings @ComponentScan
).
@SpringBootApplication
public class PaymentServiceApplication {
public static void main(String[] args) {
SpringApplication.run(PaymentServiceApplication.class, args);
}
}
My custom health check has to test for Apache Kafka, but I skipped the details for brevity.
Still, invoking /actuator/health
endpoint I get the same default result:
{
"status": "UP",
"components": {
"diskSpace": {
"status": "UP",
"details": {
"total": 250685575168,
"free": 99168997376,
"threshold": 10485760
}
},
"ping": {
"status": "UP"
}
}
}
Is there anything I may have missed?
@SpringBootApplication
, which enables component scan. – Tomek Cejner