public interface CDI11Bootstrap extends Bootstrap
Bootstrap
which allows weld to perform type discovery as required by CDI 1.2. Each CDI 1.2 compatible
integrator should use this interface.
Application container initialization API for Weld.
To initialize the container you must call, in this order:
startExtensions(Iterable)
startContainer(String, Environment, Deployment)
Bootstrap.startInitialization()
Bootstrap.deployBeans()
Bootstrap.validateBeans()
Bootstrap.endInitialization()
Bootstrap.shutdown()
Modifier and Type | Method and Description |
---|---|
Bootstrap |
startContainer(String contextId,
Environment environment,
Deployment deployment)
Creates the application container:
Checks that the services required by the environment have been provided
Adds container provided services
Creates and initializes the built in contexts
Creates the manager
|
TypeDiscoveryConfiguration |
startExtensions(Iterable<Metadata<javax.enterprise.inject.spi.Extension>> extensions)
The container bootstrap sequence begins with initializing extensions.
|
deployBeans, endInitialization, getManager, loadExtensions, parse, parse, parse, shutdown, startContainer, startInitialization, validateBeans
TypeDiscoveryConfiguration startExtensions(Iterable<Metadata<javax.enterprise.inject.spi.Extension>> extensions)
The container bootstrap sequence begins with initializing extensions. The container performs the following actions:
The container fires the BeforeBeanDiscovery
event which allows extensions to register scopes and stereotypes.
The container combines the registered scopes and stereotypes with scopes associated with the built-in contexts and built-in
stereotypes and makes the resulting set available through TypeDiscoveryConfiguration.getKnownBeanDefiningAnnotations()
Afterwards, an EE7-compatible integrator performs type discovery in the following locations:
These locations are referred to as available archives hereafter.
Next, the integrator builds the set of bean defining annotations. The set contains:
TypeDiscoveryConfiguration.getKnownBeanDefiningAnnotations()
NormalScope
or Stereotype
The resulting set is referred to as bean defining annotations hereafter.
Next, the integrator processes available archives according to these rules. The rules are exclusive.
If an archive:
beans.xml
file and the file does not contain the bean-discovery-mode
attribute, orbeans.xml
file and the value of the bean-discovery-mode
attribute is set to
all
this archive is an explicit bean archive.
If an archive:
beans.xml
file and the bean-discovery-mode
attribute is set to
annotated
, orbeans.xml
file nor any implementation of the Extension
interface but the
archive contains types annotated with a bean defining annotation or session beansthis archive is an implicit bean archive.
If an archive:
beans.xml
file and the bean-discovery-mode
attribute is set to
none
, orbeans.xml
file and contains an implementation of the Extension
interface,
orbeans.xml
file and does not contain any types annotated with a bean defining
annotation nor session beanthis archive is not a bean archive.
For each explicit bean archive the integrator creates an instance of BeanDeploymentArchive
representing this
archive. The BeanDeploymentArchive.getBeanClasses()
method returns a collection of all types present within the
archive. Filtering rules defined in BeansXml.getScanning()
are not required to be applied by the integrator and
are applied later on by Weld. The BeanDeploymentArchive.getEjbs()
method returns a collection of EJB descriptors
for EJBs present in the archive.
For each implicit bean archive the integrator creates an instance of BeanDeploymentArchive
representing this
archive. The BeanDeploymentArchive.getBeanClasses()
of the bean archive returns all the types found in the
archive which are annotated with a bean defining annotations or are Session bean definitions. Filtering rules (
BeansXml.getScanning()
) are not required to be applied by the integrator. The
BeanDeploymentArchive.getEjbs()
method returns a collection of EJB descriptors for Session beans present in the
archive.
Initially, the integrator does not need to create a BeanDeploymentArchive
instance for an archive which is not a
bean archive. Note that although these archives are ignored when building the initial collection of bean archives, the
integrator may be required to create a BeanDeploymentArchive
later upon a call to
Deployment.loadBeanDeploymentArchive(Class)
. For example, when the method is called for a extension class that is
deployed in an archive that is not a bean archive.
extensions
- discovered CDI extensionsBootstrap startContainer(String contextId, Environment environment, Deployment deployment)
In addition to Bootstrap.startContainer(Environment, Deployment)
, this method allows an identifier (contextId) to
be assigned to the container. This identifier will be used to identify this application when invoking Singleton
methods.
contextId
- the identifier of this application container instanceenvironment
- the environment in use, by default Environments.EE
deployment
- the Deployment to be bootedIllegalStateException
- if not all the services required for the given environment are availableCopyright © 2008-2015. All Rights Reserved.