首页 > 代码库 > What is the difference between J2EE and Spring

What is the difference between J2EE and Spring

 来自于:https://www.quora.com/What-is-the-difference-between-J2EE-and-Spring

 

Lot of people specially those who are new in Java world are confused with these terms J2EE, JavaEE, J2SE, JDK, Spring, EJB‘s etc.

Lets Keep it Simple Stupid.

  • What is Java Standard Edition.

(This will clear the confusion related to JDK, J2SE, JavaSE)

    1. In general, you can say this is the core of Java.(The prime part)
    2. You need it, for developing desktop applications as well as web based applications.
    3. It provides everything from basic objects to high level classes which are used for networking, database access, security, XML parsing, GUI development.
    4. Along with this core APIs, it also provides virtual machine (JVM), development tools, deployment technologies etc. (Check here for more details - JDK Development Tools)
    5. Below diagram will show you the version history of Java Standard Edition. - image taken from http://codingfox.com
技术分享
    1. You can see that Java Standard Edition was called by different names in different years. Hence these different names came into existent, which is now creating the confusion to beginners ;)
    2. But JDK, J2SE, JavaSE are same core part of Java, with more enhanced features and more classes and functionalities.
  • What is Java Enterprise Edition.

(This will clear confusion about J2EE, JavaEE)

    1. Java Enterprise Edition is an abstract specification.
    2. The concrete implementation are so called as the application servers like - GlassFish, WildFly, WebLogic.
    3. When you download JavaEE from Oracle‘s site, it will give you GlassFish server with bunch of documentations and examples. So they are just providing the implementation of Java Enterprise Edition specification.
    4. You can also prefer to use the other implementations like RedHat WildFly which also follows these specifications.
    5. Below is the version history- taken from Imgur
技术分享
    1. So, J2EE, JavaEE are just the different versions.
  • Does EJB follows JavaEE specifications?
    1. Yes, EJB is a part of JavaEE specifications. Full fledge JavaEE application server support EJB‘s out of the box.
    2. This means you can NOT run EJB applications on simple servlet container like Tomcat.
  • Does Spring follows "ALL" JavaEE specifications?
    1. Strictly speaking NO
    2. Spring is a standalone framework, which has substituted and improves many parts of JavaEE.
    3. You can consider the Spring as an integration platform that lets you use all JavaEE technologies.
    4. That means you don‘t necessarily need the full fledge JavaEE application server to support.
    5. You can run it over simple servlet container like Tomcat.

Summary

So J2EE is a version name of the abstract specification for Java Enterprise Edition from 1999 to 2003.

And Spring is a a standalone integration platform (framework) with improvements and substitutions in JavaEE which also allows you to use JavaEE technologies along with it.

What is the difference between J2EE and Spring