1 /**
2 *
3 */
4 package ar.com.jiji.kaya.app;
5
6 import javax.servlet.ServletContextEvent;
7 import javax.servlet.ServletContextListener;
8
9 import org.springframework.web.context.support.WebApplicationContextUtils;
10
11 /**
12 * Inicializa la aplicacion.<br/>
13 * <ul>
14 * <li>Setea el bean factory. Es necesario estar usando OpenSessionInViewFilter
15 * para poder realizar este paso.</li>
16 * </ul>
17 * Para usarlo hay que agregarlo como listener al <code>web.xml</code>
18 * <pre>
19 *
20 * <listener>
21 * <listener-name>webAppInit</listener-name>
22 * <listener-class>ar.com.jiji.kaya.app.AppInit</listener-class>
23 * </listener>
24 *
25 * </pre>
26 *
27 * TODO: para agregar inicializaciones se podria pasar un argumento con el
28 * nombre de una clase que implementa una interfaz y desde aca se instancia la
29 * clase y se llama.
30 *
31 * @author lparra
32 *
33 */
34 public class WebAppInit implements ServletContextListener {
35
36 public void contextInitialized(ServletContextEvent event) {
37 ProjectBeanFactory.setBeanFactory(WebApplicationContextUtils
38 .getWebApplicationContext(event.getServletContext()));
39 }
40
41 public void contextDestroyed(ServletContextEvent event) {
42 }
43
44 }