Is your feature request related to a problem? Please describe. I have a use case that I need to support multiples git backends. I found that it is possible to use Composite Repository but I realized after some tests that if a repository is not present in one of the git backends the request to configserver will throw an exception "RepositoryNotFound".
Describe the solution you'd like It would be amazing if we have the option to choose whether the request to configserver would fail or return empty for the specific git backend keeping the response from the others git backend.
Describe alternatives you've considered
I considered implementing a new Repository that inherits from SearchPathCompositeEnvironmentRepository that catch the exception and ignore it.
Something like:
@Slf4j
public class ResilientCompositeEnvironmentRepository extends SearchPathCompositeEnvironmentRepository
{
public ResilientCompositeEnvironmentRepository(List<EnvironmentRepository> environmentRepositories)
{
super(environmentRepositories);
}
@Override
public Environment findOne(String application, String profile, String label, boolean includeOrigin)
{
Environment env = new Environment(application, new String[] {profile}, label, null, null);
for (EnvironmentRepository repo : environmentRepositories)
{
try
{
env.addAll(repo.findOne(application, profile, label, includeOrigin).getPropertySources());
}
catch (Exception e)
{
log.warn("Could not find repo", e);
}
}
return env;
}
}
But the problem is that the SearchPathCompositeEnvironmentRepository bean created at EnvironmentRepositoryConfiguration is a Primary bean and I'm not able to easily override it.
Thanks
Comment From: sergioasantiago
I found that there. is flag failOnError in the newest version. I will update my spring-cloud version.