From 6400b54e9e2eaedc4f41d94cf555c7770fd2cd22 Mon Sep 17 00:00:00 2001 From: erabii Date: Tue, 12 Mar 2024 15:42:13 +0200 Subject: [PATCH] minor fix (#1342) --- .../ROOT/pages/spring-cloud-commons/loadbalancer.adoc | 8 +++++++- .../loadbalancer/LoadBalancerEagerLoadProperties.java | 5 ++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/docs/modules/ROOT/pages/spring-cloud-commons/loadbalancer.adoc b/docs/modules/ROOT/pages/spring-cloud-commons/loadbalancer.adoc index 57bbcf07..fcad589f 100644 --- a/docs/modules/ROOT/pages/spring-cloud-commons/loadbalancer.adoc +++ b/docs/modules/ROOT/pages/spring-cloud-commons/loadbalancer.adoc @@ -14,7 +14,13 @@ TIP: It is possible to disable Spring Cloud LoadBalancer by setting the value of Spring Cloud LoadBalancer creates a separate Spring child context for each service id. By default, these contexts are initialised lazily, whenever the first request for a service id is being load-balanced. -You can choose to load those contexts eagerly. In order to do that, specify the service ids for which you want to do eager load using the `spring.cloud-loadbalancer.eager-load.clients` property. +You can choose to load those contexts eagerly. In order to do that, specify the service ids for which you want to do eager load using the `spring.cloud.loadbalancer.eager-load.clients` property, for example: + +[source] +---- +spring.cloud-loadbalancer.eager-load.clients[0]=my-first-client +spring.cloud-loadbalancer.eager-load.clients[1]=my-second-client +---- [[switching-between-the-load-balancing-algorithms]] == Switching between the load-balancing algorithms diff --git a/spring-cloud-commons/src/main/java/org/springframework/cloud/client/loadbalancer/LoadBalancerEagerLoadProperties.java b/spring-cloud-commons/src/main/java/org/springframework/cloud/client/loadbalancer/LoadBalancerEagerLoadProperties.java index d99c0d8e..db9b121d 100644 --- a/spring-cloud-commons/src/main/java/org/springframework/cloud/client/loadbalancer/LoadBalancerEagerLoadProperties.java +++ b/spring-cloud-commons/src/main/java/org/springframework/cloud/client/loadbalancer/LoadBalancerEagerLoadProperties.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2021 the original author or authors. + * Copyright 2012-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,7 +16,6 @@ package org.springframework.cloud.client.loadbalancer; -import java.util.ArrayList; import java.util.List; import org.springframework.boot.context.properties.ConfigurationProperties; @@ -27,7 +26,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties; @ConfigurationProperties("spring.cloud.loadbalancer.eager-load") public class LoadBalancerEagerLoadProperties { - private List clients = new ArrayList<>(); + private List clients = List.of(); public List getClients() { return clients;