Describe the bug I'm trying to setup spring cloud config server - client configuration with multiple config servers. If my understanding is correct, it's beneficial not to have config server behind a load balancer, but connecting to multiple config server's from client directly by configuring multiple urls so I'm trying to configure it this way. And the benefit should be that config server knows if git/vault behind it are available or not and don't have to implement such logic on the load balancer side.

I'm using spring boot 2.7.10 and application.properties with spring.config.import property.

Since I have multiple urls and I don't know which server is available, I specify prefix configserver with optional: and moreover I specify fail-fast=false in the url (otherwise it fails if one of the config servers is unavailable).

But I would like to configure retry mechanism as well, but it seems it works only if specifying fail-fast=true, which is in conflict with multiple urls strategy.

Sample configurations with results Here retry works: spring.config.import=configserver:http://localhost:7779/config-server?fail-fast=true&max-attempts=3&max-interval=1500&multiplier=1.2&initial-interval=500

Here retry does not work: spring.config.import=optional:configserver:http://localhost:7779/config-server?fail-fast=false&max-attempts=100&max-interval=1500&multiplier=1.2&initial-interval=500

Here multiple urls work but retry not: spring.config.import=optional:configserver:http://localhost:7778/config-server?fail-fast=false&max-attempts=10&max-interval=1500&multiplier=1.2&initial-interval=500,optional:configserver:http://localhost:7779/config-server?fail-fast=false&max-attempts=10&max-interval=1500&multiplier=1.2&initial-interval=500

Moreover multiple urls work in the way, that all config servers are contacted (not sure if it's a feature or a bug, if it tries to find config server with most up-to-date configuration, or why it connects to all config servers).

Here retry works, but if any config server is not available, client fails (hence consider as multiple urls does not work as expected): spring.config.import=configserver:http://localhost:7778/config-server?fail-fast=true&max-attempts=10&max-interval=1500&multiplier=1.2&initial-interval=500,configserver:http://localhost:7779/config-server?fail-fast=true&max-attempts=10&max-interval=1500&multiplier=1.2&initial-interval=500

Any thoughts? Is it a bug or am I just missing something?

Comment From: ryanjbaxter

For this scenario where you want to specify a list of config servers and enable retry of each you should use spring.cloud.config.uri instead of spring.config.import. You will need to include spring-cloud-starter-bootstrap on the classpath and set spring.cloud.config.uri in bootstrap.properties.

https://docs.spring.io/spring-cloud-config/docs/4.0.2/reference/html/#_specifying_multiple_urls_for_the_config_server

Comment From: klerco

My understanding was that using bootstrap.properties is legacy approach so I was trying to avoid that - is my understanding incorrect? Or is it just a matter of time when it should work for spring.config.import as well?

I tried now using bootstrap.properties and it works, but spring.cloud.config.multiple-uri-strategy=always does not work since I'm still on Spring Boot 2.7.X and it is not compatible with 4.0.2 but 3.1.X based on release train compatibility (https://spring.io/projects/spring-cloud). Is it expected that support of multiple-uri-strategy=always will be added to 3.1.X?

Comment From: ryanjbaxter

My understanding was that using bootstrap.properties is legacy approach so I was trying to avoid that - is my understanding incorrect? Or is it just a matter of time when it should work for spring.config.import as well?

No it is not legacy we have no plans to remove support for it at the moment

Is it expected that support of multiple-uri-strategy=always will be added to 3.1.X?

No it was a new feature in the 4.0.x release

Comment From: klerco

No it is not legacy we have no plans to remove support for it at the moment

I didn't mean deprecated, just legacy and maybe just removing wording of "legacy" from the documentation may help, since it's twice mentioned there it's a legacy way of connecting to Config Server. But thank you for explanation, will consider for future use.

No it was a new feature in the 4.0.x release

I hoped 3.1.X train is still being maintaned, but seems it's not the case. Although you said it was a new feature, from my perspective it's more a bugfix, since using multiple url strategy in 3.1.X train can't be really used in production, since it checks only Config Server's availability and not it's backends.

Then we have to switch to Spring Boot 3.X and Spring Cloud 4.0.X, or using load balancer is still an option.

Thank you for your time & clarification.