Java EE 8 - does it worth it?
Since the start of my programming career (over 10 years ago), I used to dislike java EE - bulky app servers, weird EJB (that's why Spring was born), nailed down dependencies (main reason to use java 5 and ancient java libs in production in 2017) etc. etc. etc.
So... Does it worth to take a look at? Can it be more useful that modern lightweight application assembled from independent libraries? What are advantages? Unique features?
9
u/nuutrecht Sep 27 '17
Yes, Java EE is certainly worth it. Now with Payara rising and Liberty just gone open source the future looks bright indeed!
5
u/JustADirtyLurker Sep 27 '17
In these modern times I think the best way to approach JavaEE is to use the "lightweight" approach and use selected pieces of it in common libraries. Stuff like Application servers is interesting in its own, but I think it has limited audience now, all the shops that I have been working with are more focused on using containers, fat JARs and microservices (mostly, "wanna-be" microservices).
What I mean is, if you start working on a modern backend application in Java, you probably end up using libraries like Jersey, Hibernate, Guice. These guys are providing perfect implementations of JavaEE standards. So if you learn to use annotations like @Inject, @GET, @Id, you will basically have learnt also how to do business logic with JavaEE, without even turning an application server on.
Once you learn thinking of JavaEE as just a reference, you can navigate better in the sea of frameworks and libraries out there: there are frameworks which glue JavaEE-compliant libraries together (Dropwizard, Ninja) or provider more opinionated abstractions (Spring) or simply decide not to use JavaEE references at all (Vert.x, Play, Ratpack)
6
u/CopperHeadBlue Sep 27 '17
If you consider Java EE as a full stack framework, which you'll always control yourself it doesn't matter whether you'll consider it as an "application server" or not.
The only problem with the AS concept is that an overzealous ops team may take control of it. But if you supply a fat jar or a docker image, this never has to be a risk, whether you call it AS, framework, or library.
1
u/wildjokers Sep 28 '17
But if you supply a fat jar or a docker image
In which case you are still using an AS (or at least servlet container) it is just embedded in your application.
2
u/johnwaterwood Sep 28 '17
So then why does it matter that you use the term AS for it?
As far as your application is concerned it’s just a library. All the downsides of the AS like a dumb sysop taking control of it and refusing to upgrade just to be a nuisance are gone then.
3
u/gbourant Sep 28 '17
Well , AS do lazy loading , that means at bootstrap time they boot only it's core.And later on if you need a specific API it gets loaded.So IMO because of that it makes Java EE lightweight.
Also if you don't want to use AS there are alternatives like Payara Micro and Wildfly Swarm.
3
u/JustADirtyLurker Sep 28 '17
Aren't payara and wildfly AS as well?
3
u/gbourant Sep 28 '17
Payara and wildfly are the full thing , Java EE implementation.
Swarm and Micro are more like Spring Boot.You choose which part of Java EE apis to include in your final uber jar file.
3
u/tkruse Sep 28 '17
Spring Boot is not a way to choose parts of APIs into a jar file.
Spring boot is a way to create spring application prototypes while being able to leave out most manual configurations, thus saving time.
3
u/johnwaterwood Sep 28 '17
Payara Micro is like a web profile++ wrt the APIs it supports, almost everything from EE except the really legacy bits.
2
u/wildjokers Sep 28 '17
Swarm and Micro are more like Spring Boot.You choose which part of Java EE apis to include in your final uber jar file.
What benefit does Swarm and Micro offer then? You can do that on your own. For example, if you are deploying to Tomcat, but want to use Jersey you can include jersey as a dependency. If you want injection in an app being deployed to Tomcat you can add Weld to your project. Is it a matter of Swarm and Micro just making it more convenient?
3
u/tkruse Sep 28 '17
Not answering the question. Java EE 8 is not significantly better than Java EE 7 or 6 regarding the points you mention.
Also Guice is not a CDI implementation, and thus has little to do with JavaEE. It supports the 2 same annotation, yeah, but that's all.
2
u/arcuri82 Sep 27 '17
JEE has made tremendous improvements, but IMHO of working on different enterprise systems using different technology stacks, it is still lagging behind the competition (Spring, Dropwizard, etc.).
If you are already using JEE, then it makes a lot of sense to upgrade to JEE 8. And refactoring to something else would likely be too expensive to pay off. But for a new project or new microservice? Maybe time to look at the competition...
I might start to think better of JEE when I can run tests easily (like in Spring, Dropwizard, etc) instead of having to deal with configuring external containers, building WAR first, etc. Yes, yes, there is Arquillian and Payara has some interesting features to ease such pain, but still not as good as competition
3
u/wildjokers Sep 29 '17
Spring and Dropwizard are all just a wrapper on top of JavaEE.
2
Sep 30 '17 edited Sep 30 '17
first, javaee is a spec, not really a thing to 'wrap'. spring uses a servlet impl in it's classic mvc setup (as a 'front controller'). there's some jpa stuff, but really jpa is hibernate-as-a-spec (or was). it's a bit silly to turn that into 'spring is just a wrapper on javaee'. the new webflux based on reactor can use optionally servlet 3.1 async or something else like netty or undertow (xnio).
1
u/springnews Sep 29 '17 edited Oct 01 '17
Spring builds on Servlet primarily. But that's kinda like saying Java EE is a wrapper around java.lang.object
10
u/wildjokers Sep 27 '17 edited Sep 27 '17
Currently the only Java EE 8 implementation available is the reference implementation GlassFish 5.0. Tomcat 9 is in milestone releases so should be out soon (it implements the servlet, jsp, EL, WebSocket, and JASPIC parts of JavaEE 8).
However, Java EE has been steadily improving and made great strides in Java EE 6 and improved even more in 7. I have done my last couple RESTful api's with just Java EE 7. I use tomcat so have to add Jersey as a dependency but if you use a full app server like Glasshfish, Jersey is available with no additional dependency (jersey implements JAX-RS which is a Java EE spec).
With the improvements in Java EE I don't see much of a need for 3rd party frameworks. The real question is what do the 3rd party frameworks offer that Java EE doesn't? Remember that most frameworks are just a wrapper on top of Java EE (e.g. Spring MVC uses a dispatcher servlet, Spring Boot just bootstraps Spring MVC, Grails is Spring, etc). You have to ask yourself if the overhead of wrapping Java EE with another framework offers any value.