Customizing the Ribbon client

Several configuration settings of the Ribbon client may be overridden with Spring bean declarations. As with Feign, it should be declared in the client annotation field named configuration, for example,@RibbonClient(name = "account-service", configuration = RibbonConfiguration.class). The following features may be customized with this approach:

  • IClientConfig: The default implementation of this is DefaultClientConfigImpl.
  • IRule: This component is used to determine which service instance should be selected from a list. The ZoneAvoidanceRule implementation class is auto-configured.
  • IPing: This is a component that runs in the background. It is responsible for ensuring that the instances of service are running.

Get Mastering Spring Cloud now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.