Java Reference
In-Depth Information
that you supply its core annotations (such as
@Stateless
for EJB) or its
core configuration files; for example,
web.xml
for a web application.
•
Modules which need to be explicitly enabled by the application de-
ployer
: This includes all other modules, such as your custom modules
that you can add to the application server. The simplest way to allow vis-
ibility to these modules is adding an explicit dependency in your
META-
INF/MANIFEST.MF
file. For example, if you want to trigger the
log4j
dependency, you have to code your manifest file as follows:
Dependencies: org.apache.log4j
So if you followed our checklist carefully, you should be aware that in order to let
Weld libraries kick in, you should add its core configuration file, which is named
beans.xml
. This file can be placed in your application at the following locations:
• In your
WEB-INF
folder if you are developing a web application
• In your
META-INF
folder if you are deploying a JAR archive
The
beans.xml
file is based on the following schema reference:
<beans xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/
XMLSchema-instance"
xsi:schemaLocation="
http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/
beans_1_0.xsd">
</beans>
However, it is perfectly legal to place an empty
beans.xml
file in the correct loca-
tion, in order to enable CDI in your applications.
Rethinking your ticketing system
Once you have learned the basics of CDI, we will start re-engineering the Ticket
Booking system using CDI Beans wherever necessary. We will turn it into a leaner
application by dropping a few items such as remote interfaces or asynchronous