Java Reference
In-Depth Information
Description
Descriptor
Contents
Java EE standard ORM between ap-
plications and databases. May be in-
cluded as part of the following
archives: EJB-JAR, WAR, EAR, and
CAR.
META-INF/persistence.xml or WEB-
INF/persistence.xml
Java Persistence Archive (JPA)
Java EE standard dependency injection.
May be included as part of the follow-
ing archives: EJB-JAR, WAR, EAR,
and CAR.
Context Dependency and Injection
Bean Archive (CDI)
META-INF/bean.xml or WEB-INF/
bean.xml
Enterprise Java applications need to be assembled into specific types of modules. Then a
master EAR module is assembled that can be deployed to an application server. These are
the available module types as specified by Java EE.
All of these files are in the basic JDK-JAR file format. You can use the jar utility that
comes with the JDK to build them. In reality, either your IDE or your build tool (Maven or
ANT) will do the monotonous work of building the module for you. But for each module,
you must still supply the code and the deployment descriptor to configure it. Once all the
modules are assembled, the final step is to assemble the master module (that is, the EAR)
for deployment.
Deployment descriptors versus annotations
For many cases, deployment descriptors in EE archives are optional. Convention-over-con-
figuration as well as in-code annotation has taken over the heavy lifting that deployment
descriptors used to do when it came to configuring EE modules. But there are still cases
where deployment descriptors are not only useful but are required. For example, when us-
ing CDI, your archive must contain a META-INF/beans.xml or WEB-INF/beans.xml, even
if the file is empty, to indicate that your application uses CDI. So this is a case where a
deployment descriptor is required. Another example is wiring up remote EJBs in different
environments to different servers. Sure, you can hardcode remote server information in an
annotation, but it's easier to have different deployment descriptors for your archives for
different environments.
Search WWH ::




Custom Search