Java EE 5 supports the use of annotations to specify deployment information.
When applications contain a large number of Java classes, the deployment processing time for the annotations can increase.
To minimize the performance impact, you can use one of the following methods:
- Determine whether the module needs to use Java EE 5.
If the module does not need to use Java EE 5, the annotations within the Java classes are not scanned.
- Use the
metadata-complete
attribute in the module descriptor if the module uses Java EE 5 and it does not contain any annotations.
This attribute disables the annotations processing for the module, but Java EE 5 modules might still be placed in the descriptor file.
If you are migrating your application, but you are not adding annotations, consider using this attribute value.
- Restructure the application to place the utility Java archive (JAR) files into shared libraries if those JAR files do not have annotation information.
Consider this method if you cannot set the metadata-complete attribute.
- Move the JAR files in the WEB-INF\lib directory to the root directory of the enterprise archive (EAR) file.
Nested archives, such as a JAR file that is within a Web archive (WAR) that is within an enterprise application archive (EAR) file, are very cumbersome to search through because of the multiple levels of compression.
The metadata-complete flag can be defined int the in the
ejb-jar.xml or the
web.xml deployment descriptor file.
For example, an EJB module deployment descriptor would define the metadata-complete attribute as:
<ejb-jar 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/ejb-jar_3_0.xsd"
version="3.0" metadata-complete="true">
</ejb-jar>
A web module deployment descriptor would define the metadata-complete attribute as:
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee"
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
id="WebApp_ID" version="2.5" metadata-complete="true">
</web-app>
For additional information, see
Metadata for module settings.