Skip to content

JavaEE vs Spring

August 18, 2013

JavaEE – a platform that implements a collection of standardized specifications which are implemented by various vendors for compliance.

Spring – an open source application development framework for Java.

Java Enterprise Edition (Java EE)

The JavaEE specification is a collection of standardized technologies that were approved by committee. The latest specification is JavaEE7 which is currently only implemented by a single server: GlassFish4 (reference implementation). Since this is merely a specification, various vendors implement all the capabilities to be certified as compliant.

The primary advantages of JavaEE are the fact that it’s standardized and because of how it is standardized it changes very slowly. The standardization frees your deployment from any particular implementation (so long as you stick to the spec) and also eases the search for qualified people to operate in that environment. A blog post by an Oracle technical evangalist collects a number of articles and reasons why JavaEE is finally surpassing Spring:  One of his primary points is that if you follow the JavaEE specification and therefore deploy into a JavaEE container that your deployment sizes will be minuscule compared to other frameworks because the runtime dependencies are all included in the container.

The primary disadvantage of JavaEE is also it’s standardization. Because it’s a committee process the time to respond to industry changes is slow. The committee is composed of various implementors of the specification, and they have a vested interest in not changing to quickly even if it is to meet the demands of the industry. For example, the final JavaEE7 specification was released on May 28th, 2013 and yet as of today the only implementor of it is the reference implementation GlassFish.

Spring Framework

The Spring Framework is an open source framework focused on building modern Java applications. Truthfully, the comparison of JavaEE and Spring isn’t quite fair since Spring is actually built on top of many core JavaEE specification technologies: e.g. Spring Web MVC is built on top of Java Servlet API. Spring applications only require a Java Servlet container to be deployed. The distinction being a framework provides an Inversion of Control (IoC) development environment. The framework decides, at a high-level, the flow of operations to perform a certain task and then the developer merely plugs-in the necessary specifics at each step.

The advantages of using a framework like Spring are numerous. First, for a web application, Spring’s only deployment dependency is a Java Servlet container. A framework utilizes IoC and Dependency Injection heavily which reduces errors because most boilerplate code is done by the framework, and the injected code can easily be tested because of the dependency injection design pattern. The fact that the framework does so much boilerplate also allows it to “plug-in” various other components: e.g. Spring Data (and all it’s flavors), Spring XD, Spring Social, Spring Mobile, etc. Spring can put things on their roadmap based on industry needs and immediately implement it in their framework; once it’s completed then it’s ready for GA with no lag for other implementors. The collection of add-ons that “just work” with Spring is large and current and growing all the time. Spring also embraces other Java languages and technologies, specifically in Spring 4 they are using Groovy2 as their primary configuration language.

The main disadvantage is the learning curve to using Spring effectively. Although this curve is not worse than other technologies, there is a lot of information and books on patterns of development that need to be read and understood to be effective.


Both Java EE and Spring are still completely valid and the two most popular ways to build an enterprise application. Java EE has all the pieces necessary to build an application while remaining standards compliant. Spring definitely has the upper hand on the latest and greatest features. Changing from one to another is probably not worth the effort, as say upgrading from an older version to a newer version. Also, this is not an all or nothing choice … you can choose Spring and use various Java EE components which are already provided by Spring, or choose JavaEE and just use a few pieces of the Spring framework that you want.

In the end, these are both very good way to build an enterprise application … but I’ve been spoiled by the guidance that an application framework provides. Frameworks like Spring, Grails, Ruby on Rails, Django and others provide a great mechanism for plugging in new features into their frameworks by configuration only thanks to Inversion of Control.


From → Java

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: