EJB 3.1: Stateless Session Bean Deployed as .war, Dependency Injection, Asynchronous Methods

Development of an EJB 3.1 stateless session bean has become incredibly simple. You add an annotation, there is no XML required at all, no need to implement an interface anymore, and you can easily implement asynchronous methods that decouple your client calls from the method execution. Then, at the end you deploy the EJB as a simple .war file – no need to warp it in an .ear file.

 

The following screencasts explain you how to do it. You can also download the whole NetBeans project  or just a deployable .war file exactly the sources created in the screencasts.

 

Simple Stateless Session Bean with asynchronous method, developed with NetBeans 7.1 and deployed as .war file:

Asynchronous Methods with Stateless Session Bean:

Inject Stateless Session Bean into Servlet:

 

Here is a tough question at the end:

Imagine you have to add a WebLogic specific settings for your stateless session bean. There is no annotation for that. These settings have to be put in the deployment descriptor which typically used to be the weblogic-ejb-jar.xml file within an .ear file. But what if you have already build a .war file which is perfectly possible now (and neither an .ear nor an ejb.jar file).

Where do you put these settings then? Post your answer here.