We upgraded our spring-boot-starter-web library from 3.5.1 to 3.2.0 version , Spring cloud from 4.0.2 to 4.1.0 and some functional stopped working.

1) We have a spring.factories file where we register org.springframework.boot.BootstrapRegistryInitializer=com.my.configuration.CustomBootstrapper

2) In CustomBootstrapper we have custom call for config-server data loading:


public class CustomBootstrapper implements BootstrapRegistryInitializer {

    public CustomBootstrapper() {
    }

    @Override
    public void initialize(BootstrapRegistry registry) {
        registry.register(ConfigServerBootstrapper.LoaderInterceptor.class,
                context -> new CustomInterceptor(new CustomDataLoader()));
    }

    @AllArgsConstructor
    static final class CustomInterceptor implements ConfigServerBootstrapper.LoaderInterceptor {
        private final CustomDataLoader customDataLoader;

        @Override
        public ConfigData apply(ConfigServerBootstrapper.LoadContext loadContext) {
            return customDataLoader.doLoad(loadContext.getLoaderContext(), loadContext.getResource());
        }
    }
 }

(3) In class CustomDataLoader we try to get custom property from application.yml :

    public class CustomDataLoader extends ConfigServerConfigDataLoader {
    private static final Log logger = LogFactory.getLog(CustomDataLoader.class);

    public CustomDataLoader() {
        super(destination -> logger);
    }

    @Override
    protected Environment getRemoteEnvironment(ConfigDataLoaderContext context, ConfigServerConfigDataResource resource, String label, String state) {
        Binder binder = context.getBootstrapContext().get(Binder.class);
        BindResult<String> propertyBindResult = binder.bind("my-property", String.class);
       // other code
     }

// other code

Unfortunately we got null in propertyBindResult. But previously it returned the value set in application.yml.

Comment From: bclozel

This seems to be Spring Cloud specific. Can you report this to the relevant Spring Cloud project first? We can reopen this issue if it turns out that there is a problem in Spring Boot. Thanks!