package com.ticketmanor.jpa;

import javax.ejb.EJB;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

/** Load some fake data. Tried to make this a Singleton EJB
 * but WildFly didn't run its @PostConstruct method.
 * If you convert it back to a singleton, remember to unplug
 * it from web.xml!
 * @author Ian Darwin
 */
public class FakeDataLoaderListener implements ServletContextListener {

	@EJB FakeDataLoaderEjb ejb;
	
	@Override
	public void contextInitialized(ServletContextEvent ctx) {
		System.out.println("FakeEventLoader.contextInitialized()");
		ejb.loadFakeData();
	}

	@Override
	public void contextDestroyed(ServletContextEvent arg0) {
		// Empty
	}
}

@@ -131,16 +131,61 @@
 istener;
+%0Aimport javax.servlet.annotation.WebListener;
 %0A%0A/** Lo
@@ -295,89 +295,8 @@
 od.%0A
- * If you convert it back to a singleton, remember to unplug%0A * it from web.xml!%0A
  * @
@@ -317,16 +317,29 @@
 win%0A */%0A
+@WebListener%0A
 public c
@@ -545,17 +545,27 @@
 ader
-.
+: servlet 
 context
-I
+ i
 niti

Make LoaderListener with @WebListener