java.lang.Object | |||
↳ | org.springframework.ejb.support.AbstractEnterpriseBean | ||
↳ | org.springframework.ejb.support.AbstractSessionBean | ||
↳ | org.springframework.ejb.support.AbstractStatelessSessionBean |
Convenient base class for EJB 2.x stateless session beans (SLSBs), minimizing the work involved in implementing an SLSB and preventing common errors. Note that SLSBs are the most useful kind of EJB.
As the ejbActivate() and ejbPassivate() methods cannot be invoked on SLSBs, these methods are implemented to throw an exception and should not be overriden by subclasses. (Unfortunately the EJB specification forbids enforcing this by making EJB lifecycle methods final.)
There should be no need to override the setSessionContext()
or ejbCreate()
lifecycle methods.
Subclasses are left to implement the onEjbCreate()
method
to do whatever initialization they wish to do after their BeanFactory has
already been loaded, and is available from the getBeanFactory()
method.
This class provides the no-arg ejbCreate()
method required
by the EJB specification, but not the SessionBean interface, eliminating
a common cause of EJB deployment failure.
[Expand]
Inherited Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
org.springframework.ejb.support.AbstractEnterpriseBean
|
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
logger | Logger available to subclasses |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
This implementation loads the BeanFactory.
| |||||||||||
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Subclasses must implement this method to do any initialization
they would otherwise have done in an
ejbCreate() method. |
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
org.springframework.ejb.support.AbstractSessionBean
| |||||||||||
From class
org.springframework.ejb.support.AbstractEnterpriseBean
| |||||||||||
From class
java.lang.Object
| |||||||||||
From interface
javax.ejb.SessionBean
| |||||||||||
From interface
org.springframework.ejb.support.SmartSessionBean
|
Logger available to subclasses
EJBException |
---|
This implementation loads the BeanFactory. A BeansException thrown by loadBeanFactory will simply get propagated, as it is a runtime exception.
Don't override it (although it can't be made final): code your own initialization in onEjbCreate(), which is called when the BeanFactory is available.
Unfortunately we can't load the BeanFactory in setSessionContext(), as resource manager access isn't permitted there - but the BeanFactory may require it.
CreateException |
---|
EJBException |
---|
Subclasses must implement this method to do any initialization
they would otherwise have done in an ejbCreate()
method.
In contrast to ejbCreate
, the BeanFactory will have been loaded here.
The same restrictions apply to the work of this method as
to an ejbCreate()
method.
CreateException |
---|