Reloading a Commons Configuration 2 Spring bean -


i've been using reload feature of commons configuration v1 without coding when exposing configuration object spring @bean, because reload check performed every time configuration accessed.

i'm trying migrate commons configuration v2 , read reload effective on new configuration objects created builder.

in other words, while in v1 like

@bean public configuration config() {     ...     return builder.getconfiguration(); } 

then inject configuration with

@autowired configuration config; 

and expect reload (when needed) on

config.getstring("somepath"); 

now should call

builder.getconfiguration() 

again each time want fresh configuration.

so how go it? can in spring me "refresh" @bean has been injected in many @controllers? doesn't have automatic: implement "reload" button in admin console trigger it.

maybe have wrap configuration in myconfiguration class, exposed @bean, method rebuilds configuration, called console. like:

public class myconfiguration {     private configuration configuration;      ... inject builder somehow here      public void reload() {         builder.getreloadingcontroller().checkforreloading(null);         configuration = builder.getconfiguration();     }      public string getstring(string key) {         return configuration.getstring(key);     }      ... other delegated methods follow  } 

Popular posts from this blog

php - How should I create my API for mobile applications (Needs Authentication) -

5 Reasons to Blog Anonymously (and 5 Reasons Not To)

Google AdWords and AdSense - A Dynamic Small Business Marketing Duo