[ad_1]
I am trying to understand how Eureka works with Spring Boot.
I created a project which enables the Eureka Server and an other project that enables the Eureka Client.
So far so good, when I start the Server I see on the Dashboard that no instances are available and when I start the Client I can see the name of my Eureka Client on the dashboard.
Now the question, how to call my Rest API?
I found many tutorials but they are not explicit enough. I tried to call a method in the Eureka Client Application, or to add an other class as RestController. As an example;
@EnableDiscoveryClient
@SpringBootApplication
public class EurekaClientApplication
public static void main(String[] args)
SpringApplication.run(EurekaClientApplication.class, args);
@RestController
class ServiceInstanceRestController
@Autowired
private DiscoveryClient discoveryClient;
@RequestMapping("/service-instances/applicationName")
public List<ServiceInstance> serviceInstancesByApplicationName(
@PathVariable String applicationName)
return this.discoveryClient.getInstances(applicationName);
I tried to call the Rest API through many urls ... I always get a 404 error.
Is there a simple tutorial that can explain step by step how to create the connexion between the Rest API and the Eureka? And how to call the Rest API? which URL to use?
[ad_2]
لینک منبع