JAX-WS Common Annotations (JSR 250)
The JSR 250 specification includes annotations for injecting a resource into an endpoint implementation class, and for managing application lifecycle.
Note: The Java™ class that contains each annotation in the JSR 250 standard is named javax.annotation.xxx, where xxx is the name of the annotation after the '@' character. For example the Java class name for the annotation @Resource is javax.annotation.resource.
Name: Description: Properties: Definitions: @Resource This annotation marks a WebServiceContext resource that the application needs. Apply this annotation to a service endpoint implementation class for a JavaBeans™ endpoint or a Provider endpoint. The container will inject an instance of the WebServiceContext resource into the endpoint implementation when it is initialized.
- Annotation target: Field or Method
- Properties:
- authenticationType
- Indicates the enum that represents the authentication type for this resource. The valid values are APPLICATION or CONTAINER. (String)
- description
- The description of the resource. (String)
- mappedName
- The product specific name to which this resource is mapped. (String)
- name
- The Java Naming and Directory Interface (JNDI) name of the resource. (String)
- shareable
- The values indicate whether the resource can be shared between this component and other components. The default value is false. (Boolean)
- type
- Indicates the Java type of the resource. (String)
@Target(value={TYPE,FIELD,METHOD}) @Retention(value=RUNTIME) public @interface Resource { public enum AuthenticationType { APPLICATION, CONTAINER } AuthenticationType authenticationType(); String description(); String mappedName(); String name(); boolean shareable; Class type(); }@PostConstruct This annotation marks a method that must be executed after dependency injection is performed on the class. Apply this annotation to a JAX-WS application handler, a service endpoint implementation class for a JavaBeans endpoint or a Provider endpoint.
- Annotation target: Method
@Documented @Retention(value=RUNTIME) @Target(value=METHOD) public @interface PostConstruct { }@PreDestroy This annotation marks a method that must be executed when the instance is in the process of being removed by the container. Apply this annotation to a JAX-WS application handler, a service endpoint implementation class for a JavaBeans endpoint or a Provider endpoint.
- Annotation target: Method
@Documented @Retention(value=RUNTIME) @Target(value=METHOD) public @interface PreDestroy { }
Related information
JSR 250: Web Services Metadata for the Java Platform