Created
September 12, 2014 23:01
-
-
Save johnament/442e0aa78b7557535545 to your computer and use it in GitHub Desktop.
Loading configuration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@ApplicationScoped | |
public class ConfigProducer { | |
private Configuration config; | |
public void observe(@Observes Configuration config) { | |
this.config = config; | |
} | |
@Produces | |
@ApplicationScoped | |
public Configuration produce() { | |
return config; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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