Show TOC Start of Content Area

Background documentation Annotations in Web Applications  Locate the document in its SAP Library structure

This is a list of the basic annotations you can use in Web applications. Using each annotation is described in the relevant procedure.

Annotation

Description

@Resource

Declares a reference to a resource such as a data source, Java Messaging Service (JMS) destination, or environment entry.

More information: Injecting Resources into Web Applications.

@Resources

A collective annotation, allowing you to create multiple @Resource annotations inside it.

@DeclaresRoles

Declares security roles defined by the application.

More information: Configuring Security Roles Using Annotations in Web Applications.

@RunAs

Specifies the application’s security role (applicable to Servlet components only).

More information: Configuring Security Roles Using Annotations in Web Applications.

@PostConstruct

Placed at method level. Specifies that this method will be called after the resource injection is complete and before any lifecycle methods are called.

More information: Configuring Methods Using Annotations in Web Applications.

@PreDestroy

Placed at method level. Specifies that this method will be called before the component is destroyed.

More information: Configuring Methods Using Annotations in Web Applications.

@PersistenceContext

Specifies the container-managed persistency context.

More information: Accessing Persistence in Web Applications.

@PersistenceContexts

A collective annotation, allowing you to create multiple @PersistenceContext entries inside it.

@PersistenceUnit

Specifies this is a reference to an entity manager factory (used when accessing entities).

More information: Accessing Persistence in Web Applications.

@PersistenceUnits

A collective annotation, allowing you to create multiple @PersistenceUnit entries inside it.

@WebServiceRef

Specifies a reference to a Web Service.

@WebServicesRefs

A collective annotation, allowing you to create multiple @WebServiceRef entries inside it.

 

End of Content Area