Describe the bug We wanted to use Spring Cloud Config Client within a native image. During the startup of our application we saw a NullPointerException

java.lang.NullPointerException
at org.springframework.cloud.config.client.RetryTemplateFactory.create(RetryTemplateFactory.java:47)
at org.springframework.cloud.config.client.ConfigClientRetryBootstrapper.lambda$initialize$1(ConfigClientRetryBootstrapper.java:46)
at org.springframework.cloud.config.client.ConfigServerConfigDataLoader.load(ConfigServerConfigDataLoader.java:92)
at org.springframework.cloud.config.client.ConfigServerConfigDataLoader.load(ConfigServerConfigDataLoader.java:61)
at org.springframework.boot.context.config.ConfigDataLoaders.load(ConfigDataLoaders.java:96)

We had a look into RetryTemplateFactory and saw field = ReflectionUtils.findField(RetryTemplate.class, "logger"); in line 31 and field.set(retryTemplate, log); in line 47.

There is no reflect-config.json provided to describe this access.

Sample N/A

Comment From: AlexGreg

same for me..I solved it by adding to reflect-config.json

[
  {
    "name": "org.springframework.retry.support.RetryTemplate",
    "allDeclaredFields": true,
    "allDeclaredMethods": true,
    "allDeclaredConstructors": true
  },
  {
    "name": "org.springframework.cloud.config.client.RetryTemplateFactory",
    "allDeclaredMethods": true,
    "allDeclaredConstructors": true
  }
]

Comment From: klopfdreh

Hey @AlexGreg

thanks that you also commented this issue!

Exactly this needs to be provided by spring-cloud-config-client 👍

Edit: As this is a Spring Boot project the existing RuntimeHintsRegistrar can be used to apply those reflection hints.

Comment From: klopfdreh

@ryanjbaxter - should we do it this way or should I provide a RuntimeHintsRegistrar and apply the hints that way?

Comment From: klopfdreh

@ryanjbaxter - I made a suggestion as this is a Spring Project I guess we are safe to use a RuntimeHintsRegistrar. See the PR for more information, please.

Comment From: klopfdreh

@OlgaMaciaszek / @ryanjbaxter - sorry that I ask you directly for assistance, again. We are currently using Spring Cloud Config with Spring Retry and without the changes I suggested at Spring Cloud Config Client it can’t be used within a Spring Boot Native image without defining additional reflect definitions.

The changes are rather small and I only moved an existing class to its own file and added reflection hints to classes mentioned in this issue.

I would be very grateful if you could review those changes and may include them in one of the next releases.

Comment From: OlgaMaciaszek

Hi @klopfdreh Thanks for reporting the issue. Will fix it shortly.

Comment From: klopfdreh

@OlgaMaciaszek I fixed it already - just review and merge if everything is fine for you: https://github.com/spring-cloud/spring-cloud-config/pull/2456

Comment From: OlgaMaciaszek

Thanks @klopfdreh - done.