Nov 10th, 2006, 11:45 AM
POJOs running in Application Server
I have a Web Layer implemented using Apache Tomcat. It uses beans defined using spring framework.
The web layer beans uses stateless session beans defined in my Application Server. The ejb beans delegate their calls to the corresponding POJOs service objects.
The POJO service objects need access to beans defined in applin context file.
What is the best / common practice used by POJO service layer to access beans defined in spring context file?
For web layer there are helper classes that load the beans, contextloaderlistener , etc
For service layer, implemented as EJB plus POJO, how does POJO get handle to other beans?
And second part of this question is , if any POJO object needs to get handle to jndi initialcontext , can they use JNDIObjectFactoryBean?, since they r running inside j2ee container.
Can someone show me an e.g
Nov 10th, 2006, 02:17 PM
Spring has support for stateless session beans which includes access to the application context. You may want to check the spring reference on the spring support for EJB
Nov 10th, 2006, 02:25 PM
SLSB has access to context through Spring Abstract Classes. But in my case SLSB delegates calls to POJO and POJO needs to access beans.
One way to do that would be to pass handle to context to all POJOs.
Is there any other way?
Nov 10th, 2006, 09:38 PM
You could wire the POJO and all its dependencies in Spring context file. The SLSB can get the POJO instance from the spring context it has access to. That way your POJOs need not have access to Spring context.