You can use the Context and dependency injection deployment
descriptor editor to edit and validate your beans.xml file.
About this task
The
beans.xml file is required in the packaging
and deployment of a CDI-enabled project. The presence of the
beans.xml file indicates to the container that the deployed
module is a bean archive. The deployment descriptor is generated when
you install the CDI facet. See
Creating
applications that use Contexts and Dependency Injection (CDI). Initially, the
beans.xml file is empty, which
means that any annotated interceptors, decorators, or alternatives
that exist in your module are disabled. To enable these classes, you
can configure them using the CDI deployment descriptor editor.
Procedure
- To open the context and dependency injection deployment
descriptor editor, right-click your beans.xml file and select .
- Click Add to add alternatives, decorators,
and interceptors to your beans.xml file:
- The deployment descriptor validates your actions, for example,
if you add an empty class to alternatives, an error appears:
- The deployment descriptor validates your actions, for example,
if you add a non-existent class to decorators, an error appears:
- The deployment descriptor validates your actions, for example,
if you add a class to alternatives that has already been added, an
error appears:
- The deployment descriptor validates your actions, for example,
if you specify existing classes that as an alternative, interceptor
or decorator class but are not annotated with @Alternative, @Interceptor, or @Decorator respectively
an error appears: