Book Image

Advanced Java EE Development with WildFly

By : Deepak Vohra
Book Image

Advanced Java EE Development with WildFly

By: Deepak Vohra

Overview of this book

<p>This book starts with an introduction to EJB 3 and how to set up the environment, including the configuration of a MySQL database for use with WildFly. We will then develop object-relational mapping with Hibernate 4, build and package the application with Maven, and then deploy it in&nbsp;WildFly 8.1, followed by a demonstration of the use of Facelets in a web application.</p> <p>Moving on from that, we will create an Ajax application in the Eclipse IDE, compile and package it using Maven, and run the web application on WildFly 8.1 with a MySQL database. In the final leg of this book, we will discuss support for generating and parsing JSON with WildFly 8.1.</p>
Table of Contents (18 chapters)
Advanced Java EE Development with WildFly
Credits
About the Author
About the Reviewers
www.PacktPub.com
Disclaimer
Preface
Index

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: