• Post Reply Bookmark Topic Watch Topic
  • New Topic

EJB 3.0 : Vs Spring  RSS feed

 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mike/Merrick,
Do you think that EJB3.0 will be shadowed by frameworks like Spring ?
I think you've said in another thread that one advantage is that EJBs have a spec. On the other hand, one of Spring's authors' arguments is that it is better to have no spec, rather than a bad spec
 
Jeroen T Wenting
Ranch Hand
Posts: 1847
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1) Spring and EJB are not mutually exclusive. Spring can be an excellent framework to provide access to EJBs in fact without all that hassle of requesting remote interfaces, casting them, and all that stuff.
2) The EJB spec isn't necessarilly bad, it's just that EJB have been (and are being) used for a lot of things they should not have been used for.

We're using Spring to provide access to EJBs and it works like a charm.
Getting an EJB reference/stub has been reduced to

BeanFactoryLocator locator = SingletonBeanFactoryLocator.getInstance();
BeanFactory beanFactory = locator.useBeanFactory(BEAN_FACTORY_ID).getFactory();
AuthenticatorService remote = (AuthenticatorService) beanFactory.getBean(BEAN_NAME, ServiceInterface.class);
return remote;


where ServiceInterface is the interface for the EJB service you map in your Spring config.
[ August 15, 2006: Message edited by: Jeroen T Wenting ]
 
Merrick Schincariol
author
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Satou,

Rod Johnson himself contributed the forward to our book, and I think it's safe to say that they see JPA as a big step forward in enterprise Java persistence. The next release of Spring is expected to include direct support for the Java Persistence API.

The area where Spring and EJB 3 tend to collide is in terms of the component model. Both solutions offer a simple, POJO-based component model and dependency injection. In many respects the EJB 3 model is a subset of the Spring component model, but on the other hand your application may not require the added features offered by Spring.

In any case, I view the two as being compatible, and we even included an example of using Spring to test EJB 3 session beans in the book. I think that EJB 3 offers a compelling solution, and don't expect it to be overshadowed by Spring.

Cheers,

Merrick
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks both of you for your comments.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!