I have been using spring-clound-openfeign
with Consul as the service registry and Ribbon as Load Balancer. I am currently working with spring-boot 2.3.10.RELEASE.
I really like spring-cloud-feign-inheritance support which, in my understanding, allows me to write a single interface used by the server side and the client side.
From spring-boot 2.4.x
onward, the spring team recommended replacing Ribbon by spring-clould-loadbanced
as a replacement since Ribbon is no longer being maintained.
If I have an interface let say:
interface Greeting {
@GetMapping
hello(String name);
}
By using Spring Openfeign + Ribbon + Consul I could just extend it with:
@FeignClient(name="my-service-id")
interface GreetingClient extends Greeting { }
And with that I would have a client implementation with load balanced capabilities.
Can I still accomplish the same result as spring-cloud-openfeign
with spring-clould-loadbalancer
or I really need to work with RestTemplate
or DiscoveryClient
to have the client side of my API?
An over all picture of this would be highly appreciated since nonwhere else I have found a sensible answer.
If you want get work like with ribbon, need connect spring cloud loadbalancer to consul. You can read how connnect spring cloud loadbalanncer to consul into link https://docs.spring.io/spring-cloud-commons/docs/current/reference/html/#serviceregistry
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.