See the full source code of this recipe at https://github.com/eldermoraes/javaee8-cookbook/tree/master/chapter10/ch10-async-bean.