• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Java EE 8 High Performance: Java EE vs Spring

 
Greenhorn
Posts: 13
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!
Recently a lot of debates and discussions occur regarding what is better: using native Java EE stack or use one of the countless Pivotal solutions along with Spring Boot.
How do you think, what are pros and cons of using each of these variants? What is the perfect project to build it on Java EE stack and where usage of JEE is less efficient?

Thanks
 
Bartender
Posts: 1274
39
IBM DB2 Netbeans IDE Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nice question  
 
Author
Posts: 13
5
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Alex,

This is a good question. What is important to see is that the scope of JavaEE and Spring (boot or not) are overlapping but not the exact sames.

JavaEE covers the very low levels to the "medium" layers - let's say "usable layer", whereas Spring covers from just before this medium layer to the very fancy and advanced layer.
To put some features on that  statement:

- JavaEE has in its stack the connection (under Servlet API for HTTP or JMS for a more raw connection type), Spring doesn't have that and always relies on a 3rd party
- JavaEE has JPA which allows to abstract a database under an object model but Spring doesn't have that
- Spring has spring-data which allows to go further than JPA with a more advanced API (JavaEE had CMP which was the same design but far before annotation time which led to something poorly usable)
- JavaEE has CDI and Spring has spring-context to manage beans (this part is concurrent)

These small examples intend to show that both technologies have competing solutions for parts of an application for historical and technical reasons but actually both go well together. Spring is even designed to reused the portable parts of JavaEE and to be deployable in a JavaEE container (even Spring Boot).

You mentionned Spring Boot but if you have a web server you will likely use Tomcat, Jetty or Undertow which are all Servlet container (so a JavaEE technology).

Historically you can also see that they both helped each others:

- JavaEE created CDI because its programming model was too old compared to its competitors (Spring and Seam): Spring inspired JavaEE
- Spring created Spring Boot because its programming model was too complicated (too much configuration) compared to JavaEE: JavaEE inspired Spring

So in my opinion, and even if some of the guys of "both sides" like to put them one against the other, Spring and JavaEE don't really compete. It is perfectly fine to hide JavaEE behind Spring (or Spring Boot) but you still use it and need to understand what it does (otherwise you will use the old N+1 queries pattern with spring-data  for instance). They also help each other - even if it is not always intended ;).

In terms of stack you can discuss that Spring has more advanced API but that it brings back a huge dependency stack etc...
On my side I tend to make it simpler: if you are used to Spring then use Spring, if you know JavaEE then use a JavaEE container and if you miss a few feature look at DeltaSpike which brings a set of utilities for common needs in a natural fashion for JavaEE.

Performances of both stacks are very close (<5% of difference between a spring-web and JAX-RS applications on Apache Tomcat+Spring/Apache TomEE), so in my humble opinion the efficiency to look for is the developers one before all.

Romain
 
Alex Shykhman
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for the wide answer!
I'm glad it is pretty close to my own opinion.

I've had heard several times an opinion that Spring is good for making simpler things, when the main goal is to run the product and show it to customer. Especially when it doesn't requires "Rocket Science" solutions. On the other hand, JavaEE allows a lot of fine-tuning, when you need efficient persistence, transactions, fault-tolerance, horizontal scalability etc, so for complex development requests it may be better. Does this make sense?
 
Romain Manni-Bucau
Author
Posts: 13
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Alex,

Globally yes, the small side note is that not portable features can depend on the container. But concretely Spring is embed - in terms of design - so depends on EE in general to scale.
If you remove EE from Spring you don't run anymore in 90% of the cases. So it is really about the facing API more than the technology stack.  You will likely always use both
but as a developer you can only see Spring but your ops will see EE.

Romain
 
Consider Paul's rocket mass heater.
    Bookmark Topic Watch Topic
  • New Topic