org.springframework.ejb.support

## Class AbstractStatelessSessionBean

- java.lang.Object
- - org.springframework.ejb.support.AbstractEnterpriseBean
  - - org.springframework.ejb.support.AbstractSessionBean
    - - org.springframework.ejb.support.AbstractStatelessSessionBean

All Implemented Interfaces:
  Serializable, EnterpriseBean, SessionBean, SmartSessionBean

Deprecated.
as of Spring 3.2, in favor of implementing EJBs in EJB 3 style

    @Deprecated
    public abstract class AbstractStatelessSessionBean
    extends AbstractSessionBean

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.

Author:
  Rod Johnson
See Also:
  Serialized Form

### Field Summary

Fields
`protected Log` `logger` Deprecated. Logger available to subclasses

### Fields inherited from class org.springframework.ejb.support.AbstractEnterpriseBean

`BEAN_FACTORY_PATH_ENVIRONMENT_KEY`

### Constructor Summary

Constructors
Constructor and Description
`AbstractStatelessSessionBean()` Deprecated.

### Method Summary

Methods
`void` `ejbActivate()` Deprecated. This method always throws an exception, as it should not be invoked by the EJB container.
`void` `ejbCreate()` Deprecated. This implementation loads the BeanFactory.
`void` `ejbPassivate()` Deprecated. This method always throws an exception, as it should not be invoked by the EJB container.
`protected abstract void` `onEjbCreate()` Deprecated. Subclasses must implement this method to do any initialization they would otherwise have done in an `ejbCreate()` method.

### Methods inherited from class org.springframework.ejb.support.AbstractSessionBean

`getSessionContext, setSessionContext`

### Methods inherited from class org.springframework.ejb.support.AbstractEnterpriseBean

`ejbRemove, getBeanFactory, onEjbRemove, setBeanFactoryLocator, setBeanFactoryLocatorKey`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface javax.ejb.SessionBean

`ejbRemove`

### Field Detail

#### logger

    protected final Log logger

Deprecated.
Logger available to subclasses

### Constructor Detail

#### AbstractStatelessSessionBean

    public AbstractStatelessSessionBean()

Deprecated.

### Method Detail

#### ejbCreate

    public void ejbCreate()
                   throws CreateException

Deprecated.
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.

Throws:
  `CreateException`

#### onEjbCreate

    protected abstract void onEjbCreate()
                                 throws CreateException

Deprecated.
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.

Throws:
  `CreateException`

#### ejbActivate

    public void ejbActivate()
                     throws EJBException

Deprecated.
This method always throws an exception, as it should not be invoked by the EJB container.

Throws:
  `EJBException`
See Also:
  `SessionBean.ejbActivate()`

#### ejbPassivate

    public void ejbPassivate()
                      throws EJBException

Deprecated.
This method always throws an exception, as it should not be invoked by the EJB container.

Throws:
  `EJBException`
See Also:
  `SessionBean.ejbPassivate()`