title: How can I execute custom logic after Spring cloud configuration refresh?
body: <p>I have my application set up to use Spring cloud config for providing configuration and have the monitor enabled so that the config server publishes change events to my application. The configuration gets updated correctly, but I want to be notified of when the configuration changes so I can execute some custom logic based on the new config.</p>
  
  <p>I have this configuration object</p>
  
  <pre><code>@Configuration
  @RefreshScope
  @ConfigurationProperties(prefix = "my.prefix")
  public class MyConfig {
      private Map&lt;String, MyObject&gt; configs;
      private String someValue;
  
      public Map&lt;String, MyObject&gt; getConfigs(){...}
      public void setConfigs(){...}
  
      public String getSomeValue(){...}
      public void setSomeValue(){...}
  }
  ...
  public class MyObject {
     private String field1;
  
     public String getField1() {...}
     public void setField1() {...}
  }
  </code></pre>
  
  <p>And this in my config servers application.yml</p>
  
  <pre><code>my:
    prefix:
      configs:
        TEST:
          field1: "testValue"
      someValue: "test"
  </code></pre>
  
  <p>Now when I change someValue in the configuration, and the config server publishes a refresh, it calls setSomeValue() and updates the value to the new value.  I can add my custom logic to setSomeValue() and it will work fine.  However it does not seem to call setConfigs() or setField1() when updating or adding/removing entries from configs. </p>
  
  <p>I tried registering a listener for EnviornmentChangeEvents, RefreshEvents, or RefreshScopeRefreshedEvents but those are either triggered before Spring updates the values or aren't triggered at all.  I also tried adding logic to @PreDestroy and @PostConstruct methods but only the PreDestroy ends up being called and it's called before the configuration is updated.  I also tried implementing InitializingBean and putting my logic in afterPropertiesSet() but it never get's called either.</p>
  
  <p>How can I get notified when this configuration get's updated?</p>