1

I have a class in src/main/groovy (ApiService.groovy). I am defining this as a spring bean in resources.groovy as I have multiple implementations.

There is a single property for this bean:

apiService(ApiService) {
    server = '${server.address}'
}

Properties are defined in an external properties file.

All is fine when the application is first started.

However, if I change the file ApiService.groovy, the server property is null after ApiService gets reloaded.

I am using the following when starting the app with run-app:

-reloading -Ddisable.auto.recompile=false

I have also tried running Application.groovy, running the Gradle task bootRun and numerous other options for reloading but to no avail.

I have also tried using constructor based args instead, using resources.xml instead of resources.groovy but the same outcome.

Also, just for testing, I used the @Value annotation for the server property in the class itself and all was fine after a reload.

I'm running within Intellij but get the same behaviour running from the command line.

Maybe this shouldn't actually work but any suggestions/advice would be greatly appreciated to save me spending any more time on it.

Alan Hill
  • 11
  • 2

0 Answers0