Example of using Retrofit with Spring Cloud LoadBalancer integration and Eureka
Assumes eureka (from spring-cloud-samples) is running on http://localhost:8761
mvnw package
run java -jar server/target/retrofit-web-server-0.0.1-SNAPSHOT.jar
verify it is functioning at http://localhost:7111
You should see Hello World: HelloServer:myhostname:7111
run java -jar client/target/retrofit-web-client-0.0.1-SNAPSHOT.jar
verify it is functioning at http://localhost:7211
You should see Hello World: HelloServer:myhostname:7111
You may see an error while the eureka/loadbalancer caches warm up similar to the following:
Load balancer does not contain an instance for the service HelloServer
It should go away shortly.
run java -jar server/target/retrofit-web-server-0.0.1-SNAPSHOT.jar --server.port=7112
Go back to http://localhost:7211 and you should see both ports 7111
and 7112
in the output after a minute or two as you keep refreshing.