BZ-1060747: adapted existing code in order to make it work in different cdi implementations