diff --git a/reference/html/index.html b/reference/html/index.html index 6d1d3463..b5d70697 100644 --- a/reference/html/index.html +++ b/reference/html/index.html @@ -113,7 +113,7 @@ $(addBlockSwitches);
  • 2. Spring Cloud Commons: Common Abstractions
  • -
  • 3. Spring Cloud Circuit Breaker +
  • 3. Spring Cloud LoadBalancer +
  • +
  • 4. Spring Cloud Circuit Breaker +
  • -
  • 4. Configuration Properties
  • +
  • 5. Configuration Properties
  • @@ -587,7 +593,7 @@ will also be disabled since they are just a special case of /actuator/rest

    Patterns such as service discovery, load balancing, and circuit breakers lend themselves to a common abstraction layer that can be consumed by all Spring Cloud clients, independent of the implementation (for example, discovery with Eureka or Consul).

    -

    2.1. @EnableDiscoveryClient

    +

    2.1. @EnableDiscoveryClient

    Spring Cloud Commons provides the @EnableDiscoveryClient annotation. This looks for implementations of the DiscoveryClient and ReactiveDiscoveryClient interfaces with META-INF/spring.factories. @@ -735,7 +741,7 @@ For instance, Eureka’s supported statuses are UP, DOWN<

    -

    2.3. Spring RestTemplate as a Load Balancer Client

    +

    2.3. Spring RestTemplate as a Load Balancer Client

    RestTemplate can be automatically configured to use a Load-balancer client under the hood. To create a load-balanced RestTemplate, create a RestTemplate @Bean and use the @LoadBalanced qualifier, as shown in the following example:

    @@ -790,7 +796,7 @@ See {githubroot}/spring-cloud-netflix/blob/master/spring-cloud-netflix-ribbon/sr In order to use a load-balanced RestTemplate, you need to have a load-balancer implementation in your classpath. The recommended implementation is BlockingLoadBalancerClient -- add org.springframework.cloud:spring-cloud-starter-loadbalancer in order to use it. +- add Spring Cloud LoadBalancer starter to your project in order to use it. The RibbonLoadBalancerClient also can be used, but it’s now under maintenance and we do not recommend adding it to new projects. @@ -813,7 +819,7 @@ to override it, you can set the property spring.cloud.loadbalancer.ribbon.
    -

    2.4. Spring WebClient as a Load Balancer Client

    +

    2.4. Spring WebClient as a Load Balancer Client

    WebClient can be automatically configured to use a load-balancer client. To create a load-balanced WebClient, create a WebClient.Builder @Bean and use the @LoadBalanced qualifier, as shown in the following example:

    @@ -854,7 +860,7 @@ The Ribbon client or Spring Cloud LoadBalancer is used to create a full physical If you want to use a @LoadBalanced WebClient.Builder, you need to have a loadbalancer implementation in the classpath. It is recommended that you add the -org.springframework.cloud:spring-cloud-starter-loadbalancer dependency to your project. +Spring Cloud LoadBalancer starter to your project. Then, ReactiveLoadBalancer will be used underneath. Alternatively, this functionality will also work with spring-cloud-starter-netflix-ribbon, but the request will be handled by a non-reactive LoadBalancerClient under the hood. Additionally, @@ -867,22 +873,6 @@ set the value of spring.cloud.loadbalancer.ribbon.enabled to false.
    -
    - - - - - -
    - - -In order to make use of the more efficient cached version of ServiceInstanceListSupplier, - spring-cloud-starter-loadbalancer will enable caching by default. -Spring Boot Caching -mechanism will be used under the hood. If you don’t want caching to be used, you can set -the value of spring.cache.type to none. -
    -

    2.4.1. Retrying Failed Requests

    @@ -1034,10 +1024,10 @@ If you see errors such as java.lang.IllegalArgumentException: Can not set

    2.6. Spring WebFlux WebClient as a Load Balancer Client

    -

    2.6.1. Spring WebFlux WebClient with Reactive Load Balancer

    +

    2.6.1. Spring WebFlux WebClient with ReactorLoadBalancerExchangeFilterFunction

    WebClient can be configured to use the ReactiveLoadBalancer. -If you add org.springframework.cloud:spring-cloud-starter-loadbalancer to your project, +If you add Spring Cloud LoadBalancer starter to your project, ReactorLoadBalancerExchangeFilterFunction is auto-configured if spring-webflux is on the classpath. The following example shows how to configure a WebClient to use reactive load balancer under the hood:

    @@ -1082,7 +1072,7 @@ to false.

    2.6.2. Spring WebFlux WebClient with non-reactive Load Balancer Client

    -

    If you you don’t have org.springframework.cloud:spring-cloud-starter-loadbalancer in your project, +

    If you you don’t have Spring Cloud LoadBalancer starter in your project, but you do have spring-cloud-starter-netflix-ribbon, you can still use WebClient with LoadBalancerClient. LoadBalancerExchangeFilterFunction will be auto-configured if spring-webflux is on the classpath. Please note, however, that this is uses a non-reactive client under the hood. @@ -1117,43 +1107,6 @@ We suggest you use WebFlux with re instead.

    -
    -

    2.6.3. Passing your own Load-Balancer Client configuration

    -
    -

    You can also use the @LoadBalancerClient annotation to pass your own load-balancer client configuration, passing the name of the load-balancer client and the configuration class, like so:

    -
    -
    -
    -
    @Configuration
    -@LoadBalancerClient(value = "stores", configuration = StoresLoadBalancerClientConfiguration.class)
    -public class MyConfiguration {
    -
    -    @Bean
    -    @LoadBalanced
    -    public WebClient.Builder loadBalancedWebClientBuilder() {
    -        return WebClient.builder();
    -    }
    -}
    -
    -
    -
    -

    It is also possible to pass together multiple configurations (for more than one load-balancer client) via the @LoadBalancerClients annotation, as shown below:

    -
    -
    -
    -
    @Configuration
    -@LoadBalancerClients({@LoadBalancerClient(value = "stores", configuration = StoresLoadBalancerClientConfiguration.class), @LoadBalancerClient(value = "customers", configuration = CustomersLoadBalancerClientConfiguration.class)})
    -public class MyConfiguration {
    -
    -    @Bean
    -    @LoadBalanced
    -    public WebClient.Builder loadBalancedWebClientBuilder() {
    -        return WebClient.builder();
    -    }
    -}
    -
    -
    -

    2.7. Ignore Network Interfaces

    @@ -1314,16 +1267,125 @@ of compatible Spring Boot versions.

    -

    3. Spring Cloud Circuit Breaker

    +

    3. Spring Cloud LoadBalancer

    +
    +
    +

    Spring Cloud provides its own client-side load-balancer abstraction and implementation. For the load-balancing +mechanism, ReactiveLoadBalancer interface has been added and a Round-Robin-based implementation +has been provided for it. In order to get instances to select from reactive ServiceInstanceListSupplier +is used. Currently we support a service-discovery-based implementation of ServiceInstanceListSupplier +that retrieves available instances from Service Discovery using a Discovery Client available in the classpath.

    +
    +
    +

    3.1. Spring Cloud LoadBalancer integrations

    +
    +

    In order to make it easy to use Spring Cloud LoadBalancer, we provide ReactorLoadBalancerExchangeFilterFunction that can be used +with WebClient and BlockingLoadBalancerClient that works with RestTemplate. You can see more information and examples of usage +in the following sections:

    +
    + +
    +
    +

    3.2. Spring Cloud LoadBalancer starter

    +
    +

    We also provide a starter that allows you to easily add Spring Cloud LoadBalancer in a Spring Boot app. +In order to use it, just add org.springframework.cloud:spring-cloud-starter-loadbalancer to your Spring +Cloud dependencies in your build file.

    +
    +
    + + + + + +
    + + +In order to make use of the more efficient cached version of ServiceInstanceListSupplier, + spring-cloud-starter-loadbalancer will enable caching by default. +Spring Boot Caching +mechanism will be used under the hood. If you don’t want caching to be used, you can set +the value of spring.cache.type to none. +
    +
    +
    + + + + + +
    + + +If you have both Ribbon and Spring Cloud LoadBalancer int the classpath, in order to maintain +backward compatibility, Ribbon-based implementations will be used by default. In order +to switch to using Spring Cloud LoadBalancer under the hood, +make sure you set the property spring.cloud.loadbalancer.ribbon.enabled to false. +
    +
    +
    +
    +

    3.3. Passing your own Spring Cloud LoadBalancer configuration

    +
    +

    You can also use the @LoadBalancerClient annotation to pass your own load-balancer client configuration, passing the name of the load-balancer client and the configuration class, like so:

    +
    +
    +
    +
    @Configuration
    +@LoadBalancerClient(value = "stores", configuration = StoresLoadBalancerClientConfiguration.class)
    +public class MyConfiguration {
    +
    +    @Bean
    +    @LoadBalanced
    +    public WebClient.Builder loadBalancedWebClientBuilder() {
    +        return WebClient.builder();
    +    }
    +}
    +
    +
    +
    +

    It is also possible to pass together multiple configurations (for more than one load-balancer client) via the @LoadBalancerClients annotation, as shown below:

    +
    +
    +
    +
    @Configuration
    +@LoadBalancerClients({@LoadBalancerClient(value = "stores", configuration = StoresLoadBalancerClientConfiguration.class), @LoadBalancerClient(value = "customers", configuration = CustomersLoadBalancerClientConfiguration.class)})
    +public class MyConfiguration {
    +
    +    @Bean
    +    @LoadBalanced
    +    public WebClient.Builder loadBalancedWebClientBuilder() {
    +        return WebClient.builder();
    +    }
    +}
    +
    +
    +
    +
    +
    +
    +

    4. Spring Cloud Circuit Breaker

    -

    3.1. Introduction

    +

    4.1. Introduction

    Spring Cloud Circuit breaker provides an abstraction across different circuit breaker implementations. It provides a consistent API to use in your applications allowing you the developer to choose the circuit breaker implementation that best fits your needs for your app.

    -

    3.1.1. Supported Implementations

    +

    4.1.1. Supported Implementations

    • @@ -1343,7 +1405,7 @@ It provides a consistent API to use in your applications allowing you the develo
    -

    3.2. Core Concepts

    +

    4.2. Core Concepts

    To create a circuit breaker in your code you can use the CircuitBreakerFactory API. When you include a Spring Cloud Circuit Breaker starter on your classpath a bean implementing this API will automatically be created for you. A very simple example of using this API is given below

    @@ -1380,7 +1442,7 @@ The function will be passed the Throwable that caused the fallback You can optionally exclude the fallback if you do not want to provide one.

    -

    3.2.1. Circuit Breakers In Reactive Code

    +

    4.2.1. Circuit Breakers In Reactive Code

    If Project Reactor is on the class path then you can also use ReactiveCircuitBreakerFactory for your reactive code.

    @@ -1417,7 +1479,7 @@ that caused the failure.

    -

    3.3. Configuration

    +

    4.3. Configuration

    You can configure your circuit breakers using by creating beans of type Customizer. The Customizer interface has a single method called customize that takes in the Object to customize.

    @@ -1446,7 +1508,7 @@ the links below

    -

    4. Configuration Properties

    +

    5. Configuration Properties

    To see the list of all Spring Cloud Commons related configuration properties please check the Appendix page.

    diff --git a/reference/html/spring-cloud-commons.html b/reference/html/spring-cloud-commons.html index 6d1d3463..b5d70697 100644 --- a/reference/html/spring-cloud-commons.html +++ b/reference/html/spring-cloud-commons.html @@ -113,7 +113,7 @@ $(addBlockSwitches);
  • 2. Spring Cloud Commons: Common Abstractions
  • -
  • 3. Spring Cloud Circuit Breaker +
  • 3. Spring Cloud LoadBalancer +
  • +
  • 4. Spring Cloud Circuit Breaker +
  • -
  • 4. Configuration Properties
  • +
  • 5. Configuration Properties
  • @@ -587,7 +593,7 @@ will also be disabled since they are just a special case of /actuator/rest

    Patterns such as service discovery, load balancing, and circuit breakers lend themselves to a common abstraction layer that can be consumed by all Spring Cloud clients, independent of the implementation (for example, discovery with Eureka or Consul).

    -

    2.1. @EnableDiscoveryClient

    +

    2.1. @EnableDiscoveryClient

    Spring Cloud Commons provides the @EnableDiscoveryClient annotation. This looks for implementations of the DiscoveryClient and ReactiveDiscoveryClient interfaces with META-INF/spring.factories. @@ -735,7 +741,7 @@ For instance, Eureka’s supported statuses are UP, DOWN<

    -

    2.3. Spring RestTemplate as a Load Balancer Client

    +

    2.3. Spring RestTemplate as a Load Balancer Client

    RestTemplate can be automatically configured to use a Load-balancer client under the hood. To create a load-balanced RestTemplate, create a RestTemplate @Bean and use the @LoadBalanced qualifier, as shown in the following example:

    @@ -790,7 +796,7 @@ See {githubroot}/spring-cloud-netflix/blob/master/spring-cloud-netflix-ribbon/sr In order to use a load-balanced RestTemplate, you need to have a load-balancer implementation in your classpath. The recommended implementation is BlockingLoadBalancerClient -- add org.springframework.cloud:spring-cloud-starter-loadbalancer in order to use it. +- add Spring Cloud LoadBalancer starter to your project in order to use it. The RibbonLoadBalancerClient also can be used, but it’s now under maintenance and we do not recommend adding it to new projects. @@ -813,7 +819,7 @@ to override it, you can set the property spring.cloud.loadbalancer.ribbon.
    -

    2.4. Spring WebClient as a Load Balancer Client

    +

    2.4. Spring WebClient as a Load Balancer Client

    WebClient can be automatically configured to use a load-balancer client. To create a load-balanced WebClient, create a WebClient.Builder @Bean and use the @LoadBalanced qualifier, as shown in the following example:

    @@ -854,7 +860,7 @@ The Ribbon client or Spring Cloud LoadBalancer is used to create a full physical If you want to use a @LoadBalanced WebClient.Builder, you need to have a loadbalancer implementation in the classpath. It is recommended that you add the -org.springframework.cloud:spring-cloud-starter-loadbalancer dependency to your project. +Spring Cloud LoadBalancer starter to your project. Then, ReactiveLoadBalancer will be used underneath. Alternatively, this functionality will also work with spring-cloud-starter-netflix-ribbon, but the request will be handled by a non-reactive LoadBalancerClient under the hood. Additionally, @@ -867,22 +873,6 @@ set the value of spring.cloud.loadbalancer.ribbon.enabled to false.
    -
    - - - - - -
    - - -In order to make use of the more efficient cached version of ServiceInstanceListSupplier, - spring-cloud-starter-loadbalancer will enable caching by default. -Spring Boot Caching -mechanism will be used under the hood. If you don’t want caching to be used, you can set -the value of spring.cache.type to none. -
    -

    2.4.1. Retrying Failed Requests

    @@ -1034,10 +1024,10 @@ If you see errors such as java.lang.IllegalArgumentException: Can not set

    2.6. Spring WebFlux WebClient as a Load Balancer Client

    -

    2.6.1. Spring WebFlux WebClient with Reactive Load Balancer

    +

    2.6.1. Spring WebFlux WebClient with ReactorLoadBalancerExchangeFilterFunction

    WebClient can be configured to use the ReactiveLoadBalancer. -If you add org.springframework.cloud:spring-cloud-starter-loadbalancer to your project, +If you add Spring Cloud LoadBalancer starter to your project, ReactorLoadBalancerExchangeFilterFunction is auto-configured if spring-webflux is on the classpath. The following example shows how to configure a WebClient to use reactive load balancer under the hood:

    @@ -1082,7 +1072,7 @@ to false.

    2.6.2. Spring WebFlux WebClient with non-reactive Load Balancer Client

    -

    If you you don’t have org.springframework.cloud:spring-cloud-starter-loadbalancer in your project, +

    If you you don’t have Spring Cloud LoadBalancer starter in your project, but you do have spring-cloud-starter-netflix-ribbon, you can still use WebClient with LoadBalancerClient. LoadBalancerExchangeFilterFunction will be auto-configured if spring-webflux is on the classpath. Please note, however, that this is uses a non-reactive client under the hood. @@ -1117,43 +1107,6 @@ We suggest you use WebFlux with re instead.

    -
    -

    2.6.3. Passing your own Load-Balancer Client configuration

    -
    -

    You can also use the @LoadBalancerClient annotation to pass your own load-balancer client configuration, passing the name of the load-balancer client and the configuration class, like so:

    -
    -
    -
    -
    @Configuration
    -@LoadBalancerClient(value = "stores", configuration = StoresLoadBalancerClientConfiguration.class)
    -public class MyConfiguration {
    -
    -    @Bean
    -    @LoadBalanced
    -    public WebClient.Builder loadBalancedWebClientBuilder() {
    -        return WebClient.builder();
    -    }
    -}
    -
    -
    -
    -

    It is also possible to pass together multiple configurations (for more than one load-balancer client) via the @LoadBalancerClients annotation, as shown below:

    -
    -
    -
    -
    @Configuration
    -@LoadBalancerClients({@LoadBalancerClient(value = "stores", configuration = StoresLoadBalancerClientConfiguration.class), @LoadBalancerClient(value = "customers", configuration = CustomersLoadBalancerClientConfiguration.class)})
    -public class MyConfiguration {
    -
    -    @Bean
    -    @LoadBalanced
    -    public WebClient.Builder loadBalancedWebClientBuilder() {
    -        return WebClient.builder();
    -    }
    -}
    -
    -
    -

    2.7. Ignore Network Interfaces

    @@ -1314,16 +1267,125 @@ of compatible Spring Boot versions.

    -

    3. Spring Cloud Circuit Breaker

    +

    3. Spring Cloud LoadBalancer

    +
    +
    +

    Spring Cloud provides its own client-side load-balancer abstraction and implementation. For the load-balancing +mechanism, ReactiveLoadBalancer interface has been added and a Round-Robin-based implementation +has been provided for it. In order to get instances to select from reactive ServiceInstanceListSupplier +is used. Currently we support a service-discovery-based implementation of ServiceInstanceListSupplier +that retrieves available instances from Service Discovery using a Discovery Client available in the classpath.

    +
    +
    +

    3.1. Spring Cloud LoadBalancer integrations

    +
    +

    In order to make it easy to use Spring Cloud LoadBalancer, we provide ReactorLoadBalancerExchangeFilterFunction that can be used +with WebClient and BlockingLoadBalancerClient that works with RestTemplate. You can see more information and examples of usage +in the following sections:

    +
    + +
    +
    +

    3.2. Spring Cloud LoadBalancer starter

    +
    +

    We also provide a starter that allows you to easily add Spring Cloud LoadBalancer in a Spring Boot app. +In order to use it, just add org.springframework.cloud:spring-cloud-starter-loadbalancer to your Spring +Cloud dependencies in your build file.

    +
    +
    + + + + + +
    + + +In order to make use of the more efficient cached version of ServiceInstanceListSupplier, + spring-cloud-starter-loadbalancer will enable caching by default. +Spring Boot Caching +mechanism will be used under the hood. If you don’t want caching to be used, you can set +the value of spring.cache.type to none. +
    +
    +
    + + + + + +
    + + +If you have both Ribbon and Spring Cloud LoadBalancer int the classpath, in order to maintain +backward compatibility, Ribbon-based implementations will be used by default. In order +to switch to using Spring Cloud LoadBalancer under the hood, +make sure you set the property spring.cloud.loadbalancer.ribbon.enabled to false. +
    +
    +
    +
    +

    3.3. Passing your own Spring Cloud LoadBalancer configuration

    +
    +

    You can also use the @LoadBalancerClient annotation to pass your own load-balancer client configuration, passing the name of the load-balancer client and the configuration class, like so:

    +
    +
    +
    +
    @Configuration
    +@LoadBalancerClient(value = "stores", configuration = StoresLoadBalancerClientConfiguration.class)
    +public class MyConfiguration {
    +
    +    @Bean
    +    @LoadBalanced
    +    public WebClient.Builder loadBalancedWebClientBuilder() {
    +        return WebClient.builder();
    +    }
    +}
    +
    +
    +
    +

    It is also possible to pass together multiple configurations (for more than one load-balancer client) via the @LoadBalancerClients annotation, as shown below:

    +
    +
    +
    +
    @Configuration
    +@LoadBalancerClients({@LoadBalancerClient(value = "stores", configuration = StoresLoadBalancerClientConfiguration.class), @LoadBalancerClient(value = "customers", configuration = CustomersLoadBalancerClientConfiguration.class)})
    +public class MyConfiguration {
    +
    +    @Bean
    +    @LoadBalanced
    +    public WebClient.Builder loadBalancedWebClientBuilder() {
    +        return WebClient.builder();
    +    }
    +}
    +
    +
    +
    +
    +
    +
    +

    4. Spring Cloud Circuit Breaker

    -

    3.1. Introduction

    +

    4.1. Introduction

    Spring Cloud Circuit breaker provides an abstraction across different circuit breaker implementations. It provides a consistent API to use in your applications allowing you the developer to choose the circuit breaker implementation that best fits your needs for your app.

    -

    3.1.1. Supported Implementations

    +

    4.1.1. Supported Implementations

    • @@ -1343,7 +1405,7 @@ It provides a consistent API to use in your applications allowing you the develo
    -

    3.2. Core Concepts

    +

    4.2. Core Concepts

    To create a circuit breaker in your code you can use the CircuitBreakerFactory API. When you include a Spring Cloud Circuit Breaker starter on your classpath a bean implementing this API will automatically be created for you. A very simple example of using this API is given below

    @@ -1380,7 +1442,7 @@ The function will be passed the Throwable that caused the fallback You can optionally exclude the fallback if you do not want to provide one.

    -

    3.2.1. Circuit Breakers In Reactive Code

    +

    4.2.1. Circuit Breakers In Reactive Code

    If Project Reactor is on the class path then you can also use ReactiveCircuitBreakerFactory for your reactive code.

    @@ -1417,7 +1479,7 @@ that caused the failure.

    -

    3.3. Configuration

    +

    4.3. Configuration

    You can configure your circuit breakers using by creating beans of type Customizer. The Customizer interface has a single method called customize that takes in the Object to customize.

    @@ -1446,7 +1508,7 @@ the links below

    -

    4. Configuration Properties

    +

    5. Configuration Properties

    To see the list of all Spring Cloud Commons related configuration properties please check the Appendix page.