@Plugin
public class SettingsPlugin implements Module {
public void loadModule(ApiBinder apiBinder) {
this.loadAnnoSettings(apiBinder);
//
final Environment env = apiBinder.getEnvironment();
apiBinder.pushListener(ContextEvent_Started, new EventListener() {
public void onEvent(String event, Object[] params) {
AppContext appContext = (AppContext) params[0];
List<Provider<SettingsListener>> settingProvider = appContext.findBindingProvider(SettingsListener.class);
if (settingProvider == null)
return;
for (Provider<SettingsListener> provider : settingProvider) {
SettingsListener target = provider.get();
target.reload(appContext.getSettings());
env.addSettingsListener(target);
Hasor.logInfo("%s SettingsListener created.", target);
}
}
});
}