uCosminexus Application Server, API Reference Guide
This section describes the applicability of annotations of the javax.annotation package. The following sections describe the annotations that you can code in each component:
The following table lists the annotations that you can code in a WAR file:
Table 2-1 Annotations (javax.annotation package) that can be coded in WAR file (Servlet 3.0 compliant)
| Annotation name | Servlet specifications | JSP Specifications | Exception Class | ManagedBean(JSF) | Other class | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Servlet | Servlet (API) | Servlet filter | Servlet filter (API) | Event listener | Event listener (API) | JSPfile | Tag handler | Tag library event listener | |||||
| Classic tag handler | Simple tag handler | ||||||||||||
| @PostConstruct | Y | -- | Y | -- | Y | -- | -- | Y | Y | N | -- | Y# | -- |
| @PreDestroy | Y | -- | Y | -- | Y | -- | -- | Y | Y | N | -- | Y# | -- |
| @Resource | Y | -- | Y | -- | Y | -- | -- | Y | Y | N | -- | Y | -- |
| @Resources | Y | -- | Y | -- | Y | -- | -- | Y | Y | N | -- | Y | -- |
The following table lists the annotations that you can code in a WAR file.
Table 2-2 Annotations (javax.annotation package) that can be coded in a WAR file (Supported by Servlet 2.5)
| Annotation name | Servlet specifications | JSP specifications | Other class | |||||
|---|---|---|---|---|---|---|---|---|
| Servlet | Servlet filter | Event listener | JSP file | Tag handler | Tag library event listener | |||
| Classic tag handler | Simple tag handler | |||||||
| @PostConstruct | Y | Y | Y | -- | Y | Y | N | -- |
| @PreDestroy | Y | Y | Y | -- | Y | Y | N | -- |
| @Resource | Y | Y | Y | -- | Y | Y | N | -- |
| @Resources | Y | Y | Y | -- | Y | Y | N | -- |
The following table lists the annotations that you can code in an EJB-JAR file:
Table 2-3 Annotations (javax.annotation package) that can be coded in an EJB-JAR file (EJB3.1/3.0 compliant)
| Annotation name | Enterprise Bean | Exception class | Other class | |||||
|---|---|---|---|---|---|---|---|---|
| Interface | Session Bean | Entity Bean | Message-driven Bean | Interceptor | ||||
| Other than the default interceptor | Default interceptor | |||||||
| @PostConstruct | -- | Y | -- | N | Y | Y | -- | -- |
| @PreDestroy | -- | Y | -- | N | Y | Y | -- | -- |
| @Resource | -- | Y | -- | N | Y | Y | -- | -- |
| @Resources | -- | Y | -- | N | Y | Y | -- | -- |
The following table lists the annotations that you can code in a servlet or a JSP of a library JAR file:
Table 2-4 Annotations (javax.annotation package) that can be coded in a library JAR file (Servlets or JSPs)
| Annotation name | Servlet specifications | JSP specifications | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Servlet | Servlet (API) | Servlet filter | Servlet filter (API) | Event listener | Event listener (API) | JSP file | Tag handler | Tag library event listener | ||
| Classic tag handler | Simple tag handler | |||||||||
| @PostConstruct | -- | -- | Y | -- | Y | -- | -- | Y | Y | N |
| @PreDestroy | -- | -- | Y | -- | Y | -- | -- | Y | Y | N |
| @Resource | -- | -- | Y | -- | Y | -- | -- | Y | Y | N |
| @Resources | -- | -- | Y | -- | Y | -- | -- | Y | Y | N |
The following table lists the annotations that you can coded in the Enterprise Beans, exception classes, or the other classes of a library JAR file:
Table 2-5 Annotations (javax.annotation package) that can be coded in a library JAR file (Enterprise Beans, exception classes, or other classes)
| Annotation name | Enterprise Bean | Exception class | Other class | ||||
|---|---|---|---|---|---|---|---|
| Interface | Session Bean | Entity Bean | Message-driven Bean | Interceptor | |||
| @PostConstruct | -- | -- | -- | N | Y | -- | -- |
| @PreDestroy | -- | -- | -- | N | Y | -- | -- |
| @Resource | -- | -- | -- | N | Y | -- | -- |
| @Resources | -- | -- | -- | N | Y | -- | -- |
All Rights Reserved. Copyright (C) 2012, 2013, Hitachi, Ltd.