There's quite a few solutions but to me there's only two that does not feel hacky. I am not sure if Java EE 7 solved this somehow though, could not find anything when I googled.
- Use
@Startup
from EJB. This is best if you can use EJB - Use the Servlet Module from deltaspike with
@Observes @Initialized ServletContext context