1
votes

Project structure

The clientui serves webpages, using data from the 3 microservices.

I succesfully setted up ribbon to load balance between 2 instances of "microservice-produits". It works when i have this line microservice-produits.ribbon.listOfServers=localhost:9001,localhost:9011 in application.properties of clientui.

Now i'd like to make it work without having to hardcode the microservices url.

This is what i've tried :

Content of application.properties (clientui)

with application class :

Main of clientui

and RibbonClient interface : enter image description here

and pom (clientui) :

enter image description here

Following these answers (Load balancer does not have available server for client): enter image description here

I tried adding the fetchRegistry line inside application.properties and adding / removing netflix-eureka-client and netflix-eureka-server dependencies inside (clientui) pom.xml

No matter what i always get this : enter image description here

For info, the eureka console : enter image description here

So : any idea ??

1
Client ui should have eureka client starter no serverspencergibb
yes, i tried bothxpz

1 Answers

2
votes
<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>

and not

<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-netflix-eureka-client</artifactId>
</dependency>

solved my problem.