spring-cloud / spring-cloud-consul

Spring Cloud Consul
http://cloud.spring.io/spring-cloud-consul/
Apache License 2.0
808 stars 540 forks source link

Config delete does not trigger the context refresh event #740

Open chillb0nes opened 2 years ago

chillb0nes commented 2 years ago

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.