33

I am striving to know the difference between Java EE and Spring Framework. Could anyone please help me on this.

Sid
  • 1,145
  • 5
  • 17
  • 24

4 Answers4

37

Java EE is an standard, official, specification for a full featured Enterprise Application Framework stack. Includes stuff like Object-Relational Mapping, Security, Web Applications, database connectivity, transactions...

On top of Java EE specifications there are JavaEE implementations/application servers like: JBoss, Glassfish, WebSphere, Weblogic.

Spring on the other hand, is a framework doing lots of the stuff on the Java EE specifications, but in its own form. They don't follow Java EE specifications and APIs for that. But they do include a Web Framework, transaction management, security and several other solutions Java EE offers.

Pablo Santa Cruz
  • 176,835
  • 32
  • 241
  • 292
14

Java EE:

  1. Java EE industry approved standard API based framework
  2. It is predominantly based on annotations and CDI
  3. JFC MVC framework for web development
  4. JPA specification to process DB operation
  5. JTA API with implementation
  6. EJB container and POJO based implementation
  7. Oracle license

Spring:

  1. Based on IOC and AOP
  2. Based on XML configuration (now they are leveraging annotation)
  3. Uses Spring DAO framework (based on Template design pattern) to connect to database
  4. Provides abstraction layer to support various JTA implementation vendor
  5. Integrates with various Java vendors to support different capabilities such as struts etc
  6. Provides an end-to-end platform to build web application achieving loose coupling using DI and AOP
  7. Open source license
Nitin
  • 3,533
  • 2
  • 26
  • 36
  • 5
    Note that Java EE implementations, like JBoss, TomEE etc don't come with an "Oracle license", but have a normal open source license like GPL or Apache. – Arjan Tijms Jul 07 '13 at 10:32
6

Java EE:

  1. A Sun/Oracle standard that app server vendors conform to
  2. Based on Enterprise Java Beans
  3. Implemented by many vendors: BEA/Oracle, WebSphere, JBOSS, Glassfish, etc.

Spring:

  1. Not a standard; it's the brainchild of Rod Johnson and implemented by Spring/VMWare.
  2. Not based on Enterprise Java Beans; it's a POJO model. Can manage EJBs if you wish to use them, but not required.
  3. Not implemented by any vendor other than Spring.

EJB 3.1 has taken a great deal from Spring. Now it includes dependency injection, a form of aspects, and JPA. EJB 3.1 is much closer to Spring than EJB 2.0 was.

duffymo
  • 305,152
  • 44
  • 369
  • 561
  • 1
    I don't fully agree with your answer. It's a bit of a stretch to say Java EE is *based* on EJB. Yes, EJB plays an important central role in Java EE, but it's not a foundational technology. – Arjan Tijms Dec 28 '10 at 23:31
  • Additionally, EJB 3.1 has not taken anything from Hibernate. JPA has taken lots of things from Hibernate (and Hibernate has taken lots of things from TopLink, which predates it by a long time). EJB 3.1 makes it easier to work with JPA, but it most definitely does not include JPA. – Arjan Tijms Dec 28 '10 at 23:34
  • 3
    Finally, EJB 3.1 has indeed taken things from Spring and the Java EE community should be eternally thankful to Rod. The programming models are now quite similar, differing mainly in details. EJB 2.0 beans were completely the opposite of Spring beans. Lately, Spring beans are following EJB beans, which started to use annotations over XML and convention over configuration. It remains to be seen if Spring is also going to follow CDI's type safe injections (note that CDI is a very important API in Java EE and itself not based on EJB, but merely able to integrate with it). – Arjan Tijms Dec 28 '10 at 23:40
2

I provided an overview of Java EE here Frameworks for Layering reusable Architectures

This also contains a small comparison with Spring, which might be relevant for this question.

Community
  • 1
  • 1
Arjan Tijms
  • 37,782
  • 12
  • 108
  • 140