In my recent article, A glimpse at Java EE’s future, I stated that "Java EE 9 may do away with the concept of application servers completely". This generated some interest on Twitter.
Background - Project Jigsaw and Java Modularity
Some background for those not in the loop, Java 9 will introduce Project Jigsaw, which will bring modularity to the Java platform. Java has been around for some 21 years or so, the JDK includes libraries that are not used a whole lot anymore, for example, libraries to support CORBA, which was popular in the mid to late 90's but is seldom used anymore. However, the JDK team at Oracle is hesitant to remove these libraries because doing so would potentially break compatibility with existing applications that may be using them, therefore newer JDK's need to keep including these old libraries.
Project Jigsaw provides a solution to this problem, instead of including everything in the JDK, from Java 9 and beyond, the JDK will become modular. Applications will use only the modules that they use. Going back to our CORBA example, the few applications out there still using CORBA won't break, but all other applications not using CORBA won't have this unused library lying around. Project Jigsaw will work similarly to the way Maven handles dependencies today, however this functionality will be build right in the JDK.
Project Jigsaw won't be limited to eliminating "cruft" from modern versions of Java, in general, any dependencies an application may have could be declared as a module. Library authors may publish their libraries as modules, which will then be downloaded by any applications that require them at compile time when the application is built.
Modular Java EE
I had the opportunity to attend a Birds of a Feather session titled "Enterprise Java for the Cloud" during JavaOne 2016. During this session is when I heard that there is a possibility that Java EE 9 may do away with the concept of application servers, in favor of Java 9 modules. A very interesting concept and quite a change from the way we have been developing enterprise Java applications since J2EE was released back in 1999. Great news for application developers, but, should application server vendors be worried?
The answer is a resounding no. The way this would work is that vendors would provide their Java EE APIs as modules, then applications would include them as dependencies. Potentially, this could even benefit application server vendors, let me explain.
As most of you reading this blog probably know, Java EE is a series of specifications, with multiple implementations. For example, Hibernate, EclipseLink and OpenJPA are all implementations of the JPA specification. Similarly, Weld and OpenWebBeans are implementations of the CDI specification. Each application server ships with one implementation of each Java EE specification. As application developers, we are more or less stuck with the implementation that the application server vendor provides (there are ways around this, but they require jumping through hoops). If Java EE 9 adopts the modularity features of Java 9, then we as application developers may be able to pick and choose Java EE API implementations as we please, for example, we could use Hibernate as our JPA implementation, and OpenWebBeans as our CDI implementation (as far as I know, no application server currently provides these combination of CDI and JPA implementations). We as application developers benefit by picking our favorite implementations of each API, and vendors benefit by an increased pool of potential users for their Java EE API implementations.