Reputation: 1636
I am trying to expose a custom endpoint which internally calls spring actuator. but i am getting Read timed out; nested exception is java.net.SocketTimeoutException: Read timed out.
@GetMapping(value = "/${spring.application.name}/actuator/health")
public ResponseEntity<Object> createUser() {
ResponseEntity<Map> entity = this.restTemplate.getForEntity("http://localhost:" + this.port
+ "/actuator/health", Map.class);
return new ResponseEntity<>(entity, HttpStatus.OK);
}
Is there any way to make it work.
Upvotes: 1
Views: 3041
Reputation: 24637
There’s no need to create your own endpoint, just set management.endpoints.web.base-path=${spring.application.name}
in application.properties
. See https://docs.spring.io/spring-boot/docs/2.1.13.RELEASE/reference/html/production-ready-monitoring.html.
Upvotes: 1