Skip to content

Instantly share code, notes, and snippets.

View nineninesevenfour's full-sized avatar

nineninesevenfour

  • Austrian Insurance Company
  • Vienna
View GitHub Profile
@nineninesevenfour
nineninesevenfour / ApplicationInitializer.java
Last active October 8, 2022 23:06 — forked from mojavelinux/ApplicationInitializer.java
A bridge between the ServletContext life cycle events and CDI observers (with example observer ApplicationInitializer)
import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.context.Initialized;
import javax.enterprise.event.Observes;
import javax.servlet.ServletContext;
// uncomment line if you want the instance to be retained in application scope
// @ApplicationScoped
public class ApplicationInitializer
{
public void onStartup(@Observes @Initialized(ApplicationScoped.class) ServletContext ctx)