Session bean EJB resource

JAX-RS 2.0 supports stateless and singleton session beans as root resource classes. In this section, we will run the AsyncResource root resource class as a stateless session bean. We added an EJB-related dependency to pom.xml.

Annotate the AsyncResource with the Stateless annotation. The @Path annotation must also be applied to the class:

@Path("/helloworld")
@Stateless
public class AsyncResource {}

When the application is run, the root resource class gets added to the JNDI just as any other session bean would. The JNDI binding for AsycnResource is shown as follows:

Session bean EJB resource
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset