https://github.com/spring-cloud/spring-cloud-config/blob/1f18b7076cbe487e7013ea3bbc754ae0286e41b7/spring-cloud-config-client/src/main/java/org/springframework/cloud/config/client/ConfigServerConfigDataLoader.java#L191
This if should be && not ||.
if (properties.isFailFast() || !resource.isOptional()) { String reason; if (properties.isFailFast()) { reason = "the fail fast property is set"; } else { reason = "the resource is not optional"; } throw new ConfigClientFailFastException("Could not locate PropertySource and " + reason + ", failing" + (errorBody == null ? "" : ": " + errorBody), error); }
Comment From: ryanjbaxter
I dont think so.
Setting fail fast to true and having the import be optional seems to contradict itself. By saying fail fast you are saying you want the application not to start up if there is an error. But by saying its optional you are saying you don't care that the import doesnt exist and we are getting and error you want to ignore.
Comment From: zdendis
We have problem with that in case when installing on other environments. On DEV environment, we have this settings in application.yml:
spring: config: import: optional:configserver:https://localhost:8888
On TEST environment, we have system property -Dspring.config.import=configserver:https://scs.sdp.local:8888 to override the application.yml settings. But it failes on startup, cause even if connection to https://scs.sdp.local:8888 is successful, still trying to connect to https://localhost:88888 and fails (case fail-fast=true defaultly), cause on TEST environmet is not localhost:8888 available.
The filosofy of "optional:" setting should be try it and if not successful, ignore it, even if fail-fast is set true or false. Just my opinion. :)
Or, maybe issue is elsewere, when it connects to config server successfuly, it should not try another ones.
Comment From: ryanjbaxter
I think one of the problem here with this setup is that spring.config.import behaves differently than other properties.
You would expect when you set it via a system property it would override whats in the application.yaml, however that is not the case with spring.config.import, each statement is independent of each other.
Could you disable fail-fast in the test environment?
Comment From: zdendis
Yes. I did it by fail-fast=false. :) Why is it done like this? (each setting is independent of each other)
Comment From: ryanjbaxter
That’s a question for the spring boot team, I don’t have the best answer for that
Comment From: zdendis
Ok. I keep it on you, if you want that communicate with spring boot team or not.