@Vetoed public class Weld extends java.lang.Object
The preferred method of booting Weld SE.
Typical usage of this API looks like this:
Weld weld = new Weld(); WeldContainer container = weld.initialize(); container.instance().select(Foo.class).get(); container.event().select(Bar.class).fire(new Bar()); weld.shutdown();
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
ARCHIVE_ISOLATION_SYSTEM_PROPERTY |
| Constructor and Description |
|---|
Weld() |
Weld(java.lang.String containerId)
Assign a unique ID to this Weld instance.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addExtension(Extension extension)
Add extension explicitly.
|
protected Deployment |
createDeployment(ResourceLoader resourceLoader,
CDI11Bootstrap bootstrap)
Extensions to Weld SE can subclass and override this method to customize the deployment before weld boots up.
|
protected <T> T |
getInstanceByType(BeanManager manager,
java.lang.Class<T> type,
java.lang.annotation.Annotation... bindings)
Utility method allowing managed instances of beans to provide entry points for non-managed beans (such as
WeldContainer). |
WeldContainer |
initialize()
Boots Weld and creates and returns a WeldContainer instance, through which
beans and events can be accessed.
|
void |
shutdown()
Shuts down Weld.
|
public static final java.lang.String ARCHIVE_ISOLATION_SYSTEM_PROPERTY
public Weld()
public Weld(java.lang.String containerId)
containerId - the unique ID for this containerpublic void addExtension(Extension extension)
extension - an extensionpublic WeldContainer initialize()
protected Deployment createDeployment(ResourceLoader resourceLoader, CDI11Bootstrap bootstrap)
Extensions to Weld SE can subclass and override this method to customize the deployment before weld boots up. For example, to add a custom ResourceLoader, you would subclass Weld like so:
public class MyWeld extends Weld {
protected Deployment createDeployment(ResourceLoader resourceLoader, CDI11Bootstrap bootstrap) {
return super.createDeployment(new MyResourceLoader(), bootstrap);
}
}
This could then be used as normal:
WeldContainer container = new MyWeld().initialize();
resourceLoader - bootstrap - protected <T> T getInstanceByType(BeanManager manager, java.lang.Class<T> type, java.lang.annotation.Annotation... bindings)
WeldContainer). Should only called once
Weld has finished booting.manager - the BeanManager to use to access the managed instancetype - the type of the Beanbindings - the bean's qualifiersjava.lang.IllegalArgumentException - if the given type represents a type variablejava.lang.IllegalArgumentException - if two instances of the same qualifier type are givenjava.lang.IllegalArgumentException - if an instance of an annotation that is not a qualifier type is givenUnsatisfiedResolutionException - if no beans can be resolved * @throws AmbiguousResolutionException if the ambiguous dependency resolution rules
failjava.lang.IllegalArgumentException - if the given type is not a bean type of the given beanpublic void shutdown()
Copyright © 2015. All Rights Reserved.