I am using spring cloud: Spring Boot Application with Eureka + Ribbon default configuration.
I am using 2 RestTemplate
configurations, both are @LoadBalanced
currently and both of them have the same UriTemplateHandler
.
I declared both the @SpringBootApplication
and also the @RibbonClient(name="${service.name}")
annotations.
My problem is:
When I am trying to access the first configured RestTemplate
, the RestTemplate
resolvs (by eureka and load balancing by ribbon) to a server , not as I requested as configured in the UriTemplateHandler
.
For example: in the UriTemplateHandler
I configured "A-Service" and in real time the restTemplate
sends the httpRequest
to "B-Service"
This behavior happens often, not just for a specific request, but it looks like it only happens when I'm accessing the first configured RestTemplate
.
Is it a problem to use 2 RestTemplate with the same uri?
I have no idea why it happens, please advise.