@Override public void onStartup(Set<Class<?>> classes, ServletContext context) throws ServletException { log.info("Initialize Weld using ServletContainerInitializer"); lifecycle = new WeldServletLifecycle(); lifecycle.initialize(context); context.setAttribute(WeldServletLifecycle.INSTANCE_ATTRIBUTE_NAME, lifecycle); context.setAttribute( WeldServletLifecycle.LISTENER_CLASS_FLAG_ATTRIBUTE_NAME, this.getClass().getName()); context.addListener(this); super.contextInitialized(new ServletContextEvent(context)); }
@Override public void contextDestroyed(ServletContextEvent sce) { lifecycle.destroy(sce.getServletContext()); super.contextDestroyed(sce); }
@Override protected ServletListener delegate() { return lifecycle.getWeldListener(); }