Java Reference
In-Depth Information
As you see in Figure 4-3, the AbstractEnterpriseBean class forms the core of the Spring
EJB support classes. This class can be subclassed to support different forms of EJBs such
as session beans, message-driven beans, and so on. However, in most cases, you will not
need to do that because Spring already provides the appropriate subclasses. The
AbstractEnterpriseBean class helps create and load a Spring bean factory and makes it
available to the EJB.
Figure 4-3. Class diagram: Spring stateless session bean support
The AbstractEnterpriseBean is generic, and Spring provides a specialized
AbstractSessionBean class to develop session bean components. This class implements
the SessionBean interface and takes on the responsibility of saving the SessionContext
object injected by the EJB container. However, it should not be extended for supporting
SLSBs. Instead, your bean implementation should inherit from the more specialized
AbstractStatelessSessionBean . This class implements all the EJB callback methods. This is
very useful because in most cases you would require empty implementation of these call-
backs. This feature cleans up the bean implementation classes, promotes reuse, and
allows it to focus only on business logic. The subclasses should override the onEjbCreate
method to carry out any post-initialization after loading the bean factory. Finally, Listing
4-17 shows the bean implementation class.
Search WWH ::

Custom Search