Dolphin Platform & KumuluzEE: JavaEE Microservices with dynamic and rich frontends
Have you heard of KumuluzEE that is one of the 2015 Java Duke’s Choice Award winners? Well, if you haven’t heard about this cool project you should have a look. KumuluzEE is a JavaEE based framework to create microservices and JavaEE based applications that can start on their own without deploying them to an application server. If you know Spring Boot the description is quite easy: KumuluzEE is Spring Boot for the JavaEE framework. In this post I will show how you combine kumuluzEE with Dolphin Platform to create lightweight microservices with a dynamic frontend.
When using KumuluzEE you can work with all the JavaEE specs that you already know. Let’s say you want to create an application that provides some REST endpoints and uses CDI internally. To do so you need to add the following dependencies to your project:
Let’s have a deeper look what this dependencies define and add to your project:
kumuluzee-coredependencies is the basic dependency of KumuluzEE and must be added to each project
kumuluzee-servlet-jettydependencies adds an embedded jetty. This includes the implementation of the servlet API. If you only want to code based on servlets you are done now.
kumuluzee-cdidependencies adds CDI support to you application. Once this dependency is on your class path you can use CDI in your server application.
kumuluzee-jax-rsdependencies adds support for JAX-RS. By adding this dependency you can add REST endpoints to your application.
Once this is done you can create your (microservice) JavaEE application. You can use all the defaults of the specs that are added as dependencies. The following code shows how a REST endpoint might look like:
To start your app kumuluzEE adds the class
com.kumuluz.ee.EeApplication that contains a default main method. By starting the application your endpoints will be up faster than you can spell “weblogic”.
KumuluzEE and Dolphin Platform
Since KumuluzEE supports all the JavaEE specs that are needed for the Dolphin Platform it’s quite easy to create a Dolphin Platform application based on KumuluzEE. To do so you only need to add the following dependencies to your application:
Please notice that the feature is still in development and will be part of Dolphin Platform 0.7.0 ;)
Once this is done you can start to create your Dolphin Controllers that will automatically be managed by JavaEE and support features like CDI.
Thanks to KumuluzEE you can create lightweight Dolphin Platform applications by using the enterprise framework APIs that you might now and like since years. The best: Since you don’t use specific JavaEE or Spring code in your Dolphin Platform controllers they will work in both Spring and JavaEE. Just add the right dependency and your controllers will be automatically managed by the container. In my last tests both implementations bootstrapped in under 7 seconds :)