sebastiandaschner news

wednesday, august 02, 2017

Welcome to my eleventh newsletter!

The last days and weeks were pretty full with all kind of IT content. I held several onsite workshops on Kubernetes and OpenShift at a German company. It is very interesting to see quite a lot demand right now in container orchestration frameworks. Especially since Java EE plays well with Docker containers, Kubernetes or OpenShift are powerful platforms to power Java enterprise applications :-)

Two weeks ago I attended the famous JCrete unconference again. An IT event on a vacation island sounds like a bad excuse but only for those who haven’t attended yet. An unconference at such a location is a very productive yet relaxing happening. You can both enjoy the peaceful atmosphere and hack together with tons of smart people :-)

A while ago I actually recorded a video course on productivity and the importance of environments: Developer’s Productivity - Episode Environments

There are already new conferences and event upcoming the next months. I’m happy to speak at the Oracle Code event in Seoul, South Korea. I’ll be holding the keynote about Event Sourcing, Event-Driven Application and CQRS with Java as well as a session on Enterprise Testing.

I will also attend the vJUG24 conference day — for the first time as a speaker. This incredible event runs nonstop for 24 hours all across the globe — thanks to timezones and the organizers of the Virtual JUG. I’ll be presenting the 20 tips that make you more productive as a Java developer. Presented directly from Germany, the country of efficency ;-)

There is also a lot going on in the world of Java EE. Currently the Java EE 8 JSRs are passing the approval ballots like crazy. If you’re interested in what Java EE 8 will bring to you, have a look at my last newsletter issues and their sneak peek into EE 8. What is also interesting to mention that the implementation of GlassFish 5, the RI for EE 8 has begun a while ago. You can already access and try out the nightly builds.


What’s new


Book on Modern Java Enterprise Architecture

I’m very happy to announce that I’ll be writing a book on modern enterprise application development with Java EE!

My motivation for this book was to showcase that there is such a thing as modern EE :-) It will cover how to design and implement modern enterprise applications, what impact Cloud environments and Continuous Delivery have on the way we build software and what Lightweight Java EE is about. Of course it will cover how to ship Java EE with Docker and container orchestration such as Kubernetes or OpenShift. Besides that it contains motivations and realizations of automated testing, performance testing, security, logging and monitoring. Since buzzwords sell themselves well the topic of Microservices, when and how they make sense is also included.

My approach is to explain the motivations and necessities of approaches first and only then to show how they are realized with Java Enterprise. The book will be aimed for Java EE 8.

I’m already looking forward to it and I hope to be able to spread some EE-nthusiasm — sorry for that ;-)


Now finally also some Java code in this newsletter.

Caching method results with JCache

In JCache there is a handy functionality that transparently caches the result of methods. You can annotate methods of managed beans with @CacheResult and the result of the first call will be returned again without calling the actual method a second time. Per default this doesn’t cache and return exceptions.

import javax.cache.annotation.CacheResult;
// ...

public class Calculator {

    public String calculate() {
        // do some heavy lifting...

        return "Hi Duke, it's " +;


If the bean is injected and the method calculate called, the result will be cached after the first call. We can include the calculator in a JAX-RS resource as follows.

public class CalculationResource {

    Calculator calculator;

    public String calculation() {
        return calculator.calculate();


Calling that HTTP resource will return the same value for all subsequent invocations.

For this example to run in Java EE 7 application servers we for now have to declare the interceptor that is responsible for caching the result. This is due to JCache not being included in the EE umbrella (yet). Therefore this small configuration overhead needs to be done for now.

If you want to run this example in WildFly specify the interceptor in the beans.xml:


WildFly uses Infinispan that needs to be added in the pom.xml in the correct version as well.



Thanks a lot for reading and see you next time!


Did you like the content? You can subscribe to the newsletter for free:

All opinions are my own and do not reflect those of my employer or colleagues.