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)
- In general, you can say this is the core of Java.(The prime part)
- You need it, for developing desktop applications as well as web based applications.
- It provides everything from basic objects to high level classes which are used for networking, database access, security, XML parsing, GUI development.
- Along with this core APIs, it also provides virtual machine (JVM), development tools, deployment technologies etc. (Check here for more details - JDK Development Tools)
- Below diagram will show you the version history of Java Standard Edition. - image taken from http://codingfox.com
- 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 ;)
- 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)
- Java Enterprise Edition is an abstract specification.
- The concrete implementation are so called as the application servers like - GlassFish, WildFly, WebLogic.
- 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.
- You can also prefer to use the other implementations like RedHat WildFly which also follows these specifications.
- Below is the version history- taken from Imgur
- So, J2EE, JavaEE are just the different versions.
- Does EJB follows JavaEE specifications?
- Yes, EJB is a part of JavaEE specifications. Full fledge JavaEE application server support EJB's out of the box.
- This means you can NOT run EJB applications on simple servlet container like Tomcat.
- Does Spring follows "ALL" JavaEE specifications?
- Strictly speaking NO
- Spring is a standalone framework, which has substituted and improves many parts of JavaEE.
- You can consider the Spring as an integration platform that lets you use all JavaEE technologies.
- That means you don't necessarily need the full fledge JavaEE application server to support.
- 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.