Motivation: We want to deactivate the fail-fast feature for local development.

When the library spring-retry is on the classpath (comes for instance with spring-amqp) and spring.cloud.config.fail-fast is set in a different profile:

# application.yaml

spring:
  ...
  config:
    import: "optional:configserver:"
  cloud:
    config:
      uri: ${config.server.url:http://localhost:8888}
      username: user
      password: pwd
      fail-fast: true
---
spring:
  config:
    activate:
      on-profile: local
  cloud:
    config:
      fail-fast: false

In that case, an exception occurs:

Caused by: org.springframework.boot.context.config.InactiveConfigDataAccessException: Inactive property source 'Config resource 'class path resource [application.yaml]' via location 'optional:classpath:/' (document #1)' imported from location 'class path resource [application.yaml]' cannot contain property 'spring.cloud.config.fail-fast' [origin: class path resource [application.yaml] - 56:18]

The problem is this line in ConfigClientRetryBootstrapper:

boolean failFast = binder.bind(ConfigClientProperties.PREFIX + ".fail-fast", Boolean.class).orElse(false);

The binding happens in the init phase where the profile is not initialisiert. The change is described here: https://spring.io/blog/2020/08/14/config-file-processing-in-spring-boot-2-4

Many thanks!

Comment From: ttulka

A possible workaround is to set spring.config.use-legacy-processing=true.

Comment From: spencergibb

Duplicates #1797