Open jkstrauss opened 4 years ago
Immutable classes are just that and are not refreshable
@spencergibb I understand that the actual configuration object would not change; it is immutable. What I was expecting is that the application context would refresh, so that, for example, new HTTP requests would get a new configuration object that would reflect the new consul configuration.
The following line from the docs is what led me to believe that this would happen:
Configuration is currently read on startup of the application. Sending a HTTP POST to /refresh will cause the configuration to be reloaded. Config Watch will also automatically detect changes and reload the application context.
(https://cloud.spring.io/spring-cloud-consul/reference/html/#spring-cloud-consul-config-watch)
I tried manually refreshing the application with the /refresh endpoint, but I get the same results.
Refresh triggers configuration property rebinding and clears the refresh scope cache. So that statement isn't quite right
@spencergibb Please elaborate. Which statement are you referring to?
and reload the application context.
It doesn't actually reload the application context.
@ConstructorBinding annotated classes not refreshing I am using Spring Cloud version Hoxton with Spring Boot 2.2.x
Spring Boot 2.2.x introduced a an annotation
@ConstructorBinding
that allows defining@ConfigurationProperties
classes strictly through constructors, which allows using immutable classes in configurations.While the initial configuration is being loaded from my Consul K/V server, subsequent changes to the server do not get reflected in the configuration objects. The problem is not mitigated by using
@RefreshScope
.