Skip to content

Instantly share code, notes, and snippets.

@struberg
Created January 20, 2017 22:15
Show Gist options
  • Save struberg/1677ccc92a5d8818862ab9e5aca88ebe to your computer and use it in GitHub Desktop.
Save struberg/1677ccc92a5d8818862ab9e5aca88ebe to your computer and use it in GitHub Desktop.
public class ConfigLocator implements Extension {
private Config config;
public void initConfig(@Observes BeforeBeanDiscovery bbd, BeanManager bm) {
List<ConfigSource> collectedConfigSources = new ArrayList<>();
bm.fireEvent(new CollectConfig(collectedConfigSources));
this.config = ConfigProvider.newConfig()......;
bm.fireEvent(config);
}
}
and then use
CDI.current().getBeanManager().getExtension(ConfigLocator.class);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment