spring-cloud-consul icon indicating copy to clipboard operation
spring-cloud-consul copied to clipboard

Config delete does not trigger the context refresh event

Open alexplavan opened this issue 5 years ago • 1 comments

Hello everyone, I would like to know the reason behind this if-check in the ConfigWatch https://github.com/spring-cloud/spring-cloud-consul/blob/main/spring-cloud-consul-config/src/main/java/org/springframework/cloud/consul/config/ConfigWatch.java#L162

In my view, the situation when some property or whole config file is deleted is perfectly valid, and must trigger a context refresh event to switch off some beans or switch to default property values. But now this is not possible, because such events are ignored because of aforementioned if-check. I think it is possible to remove it without breaking things to support cases when properties are deleted. Please let me know if I am wrong.

alexplavan avatar Jul 29 '21 19:07 alexplavan

hi @ryanjbaxter I have opened PR #1044 to address this issue. The change handles empty Consul KV responses when the index changes and includes a regression test for config deletion. Please let me know if any further changes are needed. Thanks!

yashdotdev13 avatar Nov 03 '26 16:11 yashdotdev13