O'Reilly logo

Apache Axis2 Web Services Second Edition by Afkham Azeez, Deepal Jayasinghe

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

JSR 250 (Common Annotations)

In this section, we will be looking at some of the useful annotations introduced in the JSR 250 (Common Annotations) specification. We will be looking into the following annotations:

  • javax.annotation.Resource
  • javax.annotation.PostConstruct
  • javax.annotation.PreDestroy

javax.annotation.Resource

This annotation is used to mark a WebServiceContext resource that is needed by a web service. It is applied to a field or a method for JAX-WS endpoints. The container will inject an instance of the WebServiceContext resource into the endpoint implementation when it is initialized. This annotation is illustrated in the following example:

@WebService public class HelloImpl { @Resource private WebServiceContext context; public String ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required