|
From: Eugene K. <eu...@ja...> - 2005-04-22 16:21:23
|
Garvey, Paul M (GE Commercial Finance) wrote:
> Dmitriy,
> I haven't had a chance to look at Spring EJB support as yet
> but it sounds
> interesting, Will be reading about Spring support this weekend. IDEs
> such as JBuilder
> makes EJB development very easy, testing aside, is Spring EJB support
> easier to code
> than straight EJBs?
Paul, don't you think that rely your development on IDE is a bad idea?
I believe it is better to setup a common build process (XDoclet,
MiddleGen, Cactus, Ant/Maven, etc) and do not rely on concrete IDE.
By the way, I have strange feeling about current Spring's EJB
convenience classes. The idea is that they will automatically lookup
Spring's application context for you and then you'll use
getBeanFactory().getBean() in onEjbCreate() method to pull pring-managed
POJO. However it require java:comp/env/ejb/BeanFactoryPath env property
to be set and also custom implementation setSessionContext() in order to
make bean factory a singleton (I don't know who would want non-singleton
factory?).
So, we've ended up with our own EJBM helper classes (very similar to
the Spring but without factory ) and a custom SpringLocator singleton
that I'm using in onEjbCreate() methods instead:
public class SpringLocator {
private static final ApplicationContext context = new
ClassPathXmlApplicationContext( CONTEXT_PATH);
public static Object getBean(String id) {
return context.getBean(id);
}
....
In this case I don't have to override setSessionContext in every bean.
That of course only makes sence and should be used only on facade beans
(session/mdb or transaction) and all inner components should use DI and
not locator.
regards,
Eugene
|