Skip to content

Instantly share code, notes, and snippets.

@johnament
Created September 12, 2014 23:01
Show Gist options
  • Save johnament/442e0aa78b7557535545 to your computer and use it in GitHub Desktop.
Save johnament/442e0aa78b7557535545 to your computer and use it in GitHub Desktop.
Loading configuration
@ApplicationScoped
public class ConfigProducer {
private Configuration config;
public void observe(@Observes Configuration config) {
this.config = config;
}
@Produces
@ApplicationScoped
public Configuration produce() {
return config;
}
}
public static void main(String[] args) {
BeanManager beanManager = ...; // get this from your cdi container loader
Configuration config = new Configuration(args); // or however else you do it.
beanManager.fireEvent(config);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment