Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

After upgrading Spring Boot from 3.1.5 to 3.2.0 properties from application.yml are missing #39238

Closed
anvo1115 opened this issue Jan 18, 2024 · 1 comment
Labels
for: external-project For an external project and not something we can fix status: invalid An issue that we don't feel is valid

Comments

@anvo1115
Copy link

anvo1115 commented Jan 18, 2024

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.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jan 18, 2024
@bclozel
Copy link
Member

bclozel commented Jan 18, 2024

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!

@bclozel bclozel closed this as not planned Won't fix, can't repro, duplicate, stale Jan 18, 2024
@bclozel bclozel added status: invalid An issue that we don't feel is valid for: external-project For an external project and not something we can fix and removed status: waiting-for-triage An issue we've not yet triaged labels Jan 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
for: external-project For an external project and not something we can fix status: invalid An issue that we don't feel is valid
Projects
None yet
Development

No branches or pull requests

3 participants