1- You can use WebSphere extension startup beans if you want to initialize the context immediately (As soon as application starts). But startup beans are not supported in Ejb3. You have to have ejb2 module.
2- You can initialize the context with ClasspathXmlApplicationContext like you did in standalone application. Create a ContextLocator class, keep a AppliationContext reference in it, and in getter method of this reference, check for it is already initialized or not, if not initialized, instantiate the context with xml config file parameters.
3- You can initialize the context with ContextSingletonBeanFactoryLocator, you're gonna access the context with this class, and it will initialize the context on first request. But you should have beanRefContext.xml on your classpath.
4- Create a web module, and use ContextLoaderListener.
Senior Consultant
Turkiye Is Bankasi