You may see below error
When you try default page, or click link in Eureka server {http://{yourHostname}:8203/actuator/info}, this will lead to error page.
Error
eg: http://{yourHostname}:8203/actuator/info
Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing this as a fallback.
Thu Jun 15 08:12:28 IST 2023
There was an unexpected error (type=Not Found, status=404).
No message available
I have seen some have answered to solve this by adding simple controller for "/" mapping
package com.demo.micro.student.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class HomeController {
@RequestMapping("/")
public String home(){
return "Hello World";
}
}
this won't actually solve the issue
Solution
add below property to application.properties
#Enable actuator and all
management.endpoints.web.exposure.include=*
As of Spring Boot 2.0.0.RELEASE the default prefix for all endpoints is /actuator So if you want to check the health of an application, you should go to /actuator/health
To make an actuator endpoint available via HTTP, it needs to be both enabled and exposed.
By default:
- only the /health and /info endpoints are exposed.
- all endpoints but /shutdown are enabled (only /health and /info are exposed)
Above property will enable all.
No comments:
Post a Comment