@ConfigurationProperties with or without @RefreshScope
Hi guys,
Quick question, we are using Spring Cloud Config Server and Client (of course, because it is really cool stuff ;-)) and we have a lot of classes annotated with @ConfigurationProperties. For example:
@RefreshScope
@Component
@ConfigurationProperties(prefix = "myproject.cache")
public class CacheProperties {
private int timeout = 300;
public int getTimeout() {
return timeout;
}
public void setTimeout(int timeout) {
this.timeout = timeout;
}
}
In https://github.com/spring-cloud/spring-cloud-config/issues/504 @spencergibb stated:
Remove @RefreshScope from Config since @ConfigurationProperties classes are already refreshed.
We've read https://cloud.spring.io/spring-cloud-static/docs/1.0.x/spring-cloud.html#_environment_changes but it's not clear to us if can we remove the @RefreshScope annotation and still have a working properties class which refreshes after /refresh is called.
Could you clarify this? Thanks in advance!
Please read https://gist.github.com/dsyer/a43fe5f74427b371519af68c5c4904c7