public class WeldInitiator extends AbstractWeldInitiator
WeldJunit5Extension.
@ExtendWith(WeldJunit5Extension.class)
public class SimpleTest {
@WeldSetup
public WeldInitiator weld = WeldInitiator.of(Foo.class);
@Test
public void testFoo() {
// Weld container is started automatically
// WeldInitiator can be used to perform programmatic lookup of beans
assertEquals("baz", weld.select(Foo.class).get().getBaz());
}
}
| Modifier and Type | Class and Description |
|---|---|
static class |
WeldInitiator.Builder
This builder can be used to customize the final
WeldInitiator instance, e.g. |
AbstractWeldInitiator.AbstractBuilder<I extends AbstractWeldInitiator,T extends AbstractWeldInitiator.AbstractBuilder<I,T>>, AbstractWeldInitiator.ToInjectbeans, container, extension, instancesToInject, scopesToActivate, weld| Modifier and Type | Method and Description |
|---|---|
static org.jboss.weld.environment.se.Weld |
createWeld()
The returned
Weld instance has:
automatic discovery disabled
concurrent deployment disabled
|
static WeldInitiator.Builder |
from(Class<?>... beanClasses)
Create a builder instance.
|
static WeldInitiator.Builder |
from(org.jboss.weld.environment.se.Weld weld)
Create a builder instance.
|
static WeldInitiator.Builder |
fromTestPackage()
Create a builder instance.
|
static WeldInitiator |
of(Class<?>... beanClasses)
The container is configured with the result of
createWeld() method and the given bean classes are added. |
static WeldInitiator |
of(org.jboss.weld.environment.se.Weld weld)
The container is configured through a provided
Weld instance. |
static WeldInitiator |
ofTestPackage()
The container is configured with the result of
createWeld() method and all the classes from the test class
package are added. |
static WeldInitiator |
performDefaultDiscovery()
The container is instructed to do automatic bean discovery, the resulting bean archive is NOT synthetic.
|
container, createToInject, destroy, event, get, getBeanManager, getId, initWeldContainer, injectInstances, isAmbiguous, isRunning, isUnsatisfied, iterator, releaseInstances, select, select, select, shutdown, shutdownWeldContainerclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitforEach, spliteratorpublic static WeldInitiator of(Class<?>... beanClasses)
createWeld() method and the given bean classes are added. If any
of added classes is an extension, it is automatically recognized and enabled.beanClasses - Weld.beanClasses(Class...)public static WeldInitiator of(org.jboss.weld.environment.se.Weld weld)
Weld instance.weld - public static WeldInitiator ofTestPackage()
createWeld() method and all the classes from the test class
package are added.public static WeldInitiator performDefaultDiscovery()
WeldInitiator.of(new Weld()) invocation.public static WeldInitiator.Builder from(Class<?>... beanClasses)
weld - of(Class...)public static WeldInitiator.Builder from(org.jboss.weld.environment.se.Weld weld)
weld - of(Weld)public static WeldInitiator.Builder fromTestPackage()
ofTestPackage()public static org.jboss.weld.environment.se.Weld createWeld()
Weld instance has:
Weld instance suitable for testingAbstractWeldInitiator.createWeld()Copyright © 2018. All rights reserved.