This subsection describes the purpose and scope of the functionality for controlling the annotation references.
The functionality for controlling the annotation references is used to specify whether to reference (parsing) annotations in J2EE applications. To determine the presence of annotations in a module, the application must be parsed. However, if all the applications are parsed, unnecessary overhead occurs for the applications not using annotations. Also, for the applications that reference resources and other applications, a class file reference error might occur during annotation parsing and the deployment might fail.
If you use the functionality for controlling the annotation references, you can control the parsing of annotations when an annotation is not used.
You can use the functionality for controlling the annotation references in Servlet 2.5 or later. The functionality for controlling the annotation references cannot be used in EJB 3.0 and later.
The operations in Servlet 2.5 or later are as follows:
The scope of the functionality for controlling the annotation references differs according to the module type that includes the annotation.
The following table describes the scope of the functionality for controlling the annotation references.
Table 12-10 Scope of the functionality for controlling the annotation references
Module version | Presence of DD and specified contents | Scope of reference control | |||
---|---|---|---|---|---|
J2EE servers | Modules | ||||
EJB | 1.1, 2.0 | DD exists (metadata-complete attribute does not exist) | -- | -- | |
2.1#1 | DD exists (metadata-complete attribute does not exist) | Y#2 | -- | ||
3.0 or later | No DD | N | Y | ||
DD exists (metadata-complete attribute exists) | Omitted | N | Y | ||
Specified | N | Y#3 | |||
Servlet | 2.2, 2.3 2.4#1 2.5 or later | DD exists (metadata-complete attribute does not exist) | -- | -- | |
DD exists (metadata-complete attribute does not exist) | Y#2 | -- | |||
No DD | N | Y | |||
DD exists (metadata-complete attribute exists) | Omitted | N | Y | ||
Specified | N | Y |
#1: The use of annotations with EJB 2.1 and Servlet 2.4 is the functionality for compatibility with the earlier versions. For details, see 5.4 Using annotations with EJB 2.1 and Servlet 2.4 in the uCosminexus Application Server Maintenance and Migration Guide.
#2: If enabled, the J2EE application containing the EJB 2.1 or Servlet 2.4 modules with the annotations coded cannot be used.
#3: You cannot specify true as the value. If true is specified, the importing and redeploying of applications in the J2EE server fails.
Specify the module settings in the metadata-complete attribute of the DD. Specify the J2EE server settings in the ejbserver.deploy.applications.metadata_complete property. The following table describes whether the annotations are referenced when the settings for the modules and J2EE servers are combined.
Table 12-11 Combining the settings for the J2EE servers and modules
Module version | Settings for modules | Settings for J2EE servers | |||
---|---|---|---|---|---|
Property is not specified | ejbserver.deploy.applications.metadata_complete property | ||||
false | true | ||||
EJB 3.0 or later | No DD | Y | Y | Y | |
DD exists (metadata-complete attribute exists) | Omitted | Y | Y | Y | |
false | Y | Y | Y | ||
true | --# | --# | --# | ||
Servlet 2.5 or later | No DD | Y | Y | Y | |
DD exists (metadata-complete attribute exists) | Omitted | Y | Y | Y | |
false | Y | Y | Y | ||
true | N | N | N |
#: The application containing EJB 3.0 with true specified in the metadata-complete attribute of the DD cannot be imported and redeployed.