PDA

View Full Version : Applying an additional BeanPostProcessor to Spring EJBs



aloew
Mar 31st, 2005, 05:01 PM
All,

I have successfully managed to set up a remote client calling into a springified Stateless Session Bean which extends AbstractStatelessSessionBean.

Accessing the default BeanFactory as created by the ContextJndiBeanFactoryLocator from java:comp/env/ejb/BeanFactoryPath works fine as well. :D

But this now is where my problem starts:

Before using this BeanFactory in order to access my POJO beans from the SLSB facade, I would like to add an additional custom BeanPostProcessor to this bean factory.

I tried to do this by adding the BeanPostProcessor to the BeanFactory as retrieved from getBeanFactory() in my onEjbCreate() method implementation, but failed: :cry:

The problem seems to be that the BeanFactory will already be pre-initialized by DefaultListableBeanFactory.preInstantiateSingleton s() called from loadBeanFactory() in AbstractStatelessSessionBean.ejbCreate() before the first line of my onEjbCreate() code will even be reached.

:?: So what is the recommended "standard" way of solving this? Is overriding the default ContextJndiBeanFactoryLocator by a custom BeanFactoryLocator class the only possible solution? :?:

Many thanks in advance for any comments or hints,
best regards from Germany,

Andreas