Java Code Examples for javax.enterprise.inject.se.SeContainerInitializer#initialize()

The following examples show how to use javax.enterprise.inject.se.SeContainerInitializer#initialize() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DemoApplication.java    From Sentinel with Apache License 2.0 6 votes vote down vote up
public static void main(String[] args) {
    SeContainerInitializer containerInit = SeContainerInitializer.newInstance();
    SeContainer container = containerInit.initialize();

    TestService testService = container.select(TestService.class).get();

    testService.test();

    System.out.println(testService.hello(-1));
    System.out.println(testService.hello(1));

    System.out.println(testService.helloAnother("bad"));

    try {
        System.out.println(testService.helloAnother("foo"));
    } catch (IllegalStateException e) {
        System.err.println(e.getMessage());
    }

    System.out.println(testService.helloAnother("weld"));

    container.close();
    System.exit(0);
}
 
Example 2
Source File: AccountApplication.java    From cdi with Apache License 2.0 5 votes vote down vote up
public static void main(final String[] args) {
    SeContainerInitializer initializer = SeContainerInitializer.newInstance();

    try (SeContainer container = initializer.initialize()) {
        container.select(AccountApplication.class).get().run();
    }
}
 
Example 3
Source File: GreeterTest.java    From ee8-sandbox with Apache License 2.0 5 votes vote down vote up
@Test
public void bootBasicContainer() {
    SeContainerInitializer initializer = SeContainerInitializer.newInstance();
    try (SeContainer container = initializer.initialize()) {
        assertTrue(container.isRunning());
        Set<Bean<?>> greeters = container.getBeanManager().getBeans("greeter");
        assertTrue(greeters.size() == 1);
    }
}
 
Example 4
Source File: Main.java    From smallrye-reactive-messaging with Apache License 2.0 4 votes vote down vote up
public static void main(String[] args) throws InterruptedException {
    SeContainerInitializer instance = SeContainerInitializer.newInstance();
    instance.initialize();

    Thread.sleep(10000);
}
 
Example 5
Source File: SentinelAnnotationInterceptorIntegrationTest.java    From Sentinel with Apache License 2.0 4 votes vote down vote up
@BeforeClass
public static void init() {
    SeContainerInitializer containerInit = SeContainerInitializer.newInstance();
    container = containerInit.initialize();
}
 
Example 6
Source File: MainApp.java    From tutorials with MIT License 4 votes vote down vote up
public static void main(String[] args) {
    SeContainerInitializer initializer = SeContainerInitializer.newInstance();
    try (SeContainer container = initializer.initialize()) {
    }
}
 
Example 7
Source File: BootstrappingApplication.java    From tutorials with MIT License 4 votes vote down vote up
public static void main(String... args) {
    SeContainerInitializer containerInitializer = SeContainerInitializer.newInstance();
    try (SeContainer container = containerInitializer.initialize()) {
        container.getBeanManager().fireEvent(new ExampleEvent("Welcome to Baeldung!"));
    }
}