springjakarta-eejbossejbejb-3.1

Spring vs EJB - Distribution between the apps ( Remoting )


Analyzing Spring and EJB 3.x to migrate a existing apps from EJB 2.1 deployed in JBOSS 5.1 with Java 6.

I see many advocates for Spring as that showed the path to EJB 3 despite not being J2EE standard.

However when it comes to distribution, I feel EJB 3.x has bit edge over SPRING as it has simplified JNDI lookup and WebService distribution. @EJB and Webservice annotation makes them further easier. Can use JNDI lookup for Java application and WebService calls if requires.

Looking forward different views regarding this, thanks

Found a nice comparison, http://www.future-processing.pl/blog/another-one-on-spring-framework-and-enterprise-javabeans/


Solution

  • Spring has different options for distribution (also known as remoting), different options are explained in the reference guide.

    Out of the box Spring supports remoting via

    You can also create a SOAP based webservice using Spring WS (or Apache CXF or...) and you could use Spring MVC to expose endpoint through Rest.

    The Spring AMQP project also supports remoting over RabbitMQ.

    If you want to go really flexible you can always have a look at Spring Integration.

    And if you want you can always combine Spring with EJB. Advantage of this is you get distributed transactions (if you want to use those) and management of resources by your application server. With the Spring Remoting options (most of them) you would have to solve this in a different way.

    Basically I would say Spring offers more freedom in choice of distribution then Java EE with EJB or webservices (JAX-WS and JAX-RS) does.