public interface ServletContextListener extends EventListener { /** ** Notification that the web application initialization ** process is starting. ** All ServletContextListeners are notified of context ** initialization before any filter or servlet in the web ** application is initialized. */ public void contextInitialized ( ServletContextEvent sce ); /** ** Notification that the servlet context is about to be shut down. ** All servlets and filters have been destroy()ed before any ** ServletContextListeners are notified of context ** destruction. */ public void contextDestroyed ( ServletContextEvent sce ); } ContextLoaderListener extends ContextLoader implements ServletContextListener 在web.xml中配置ContextLoaderListener,会导致容器在启动时调用ContextLoaderListener的contextInitialized方法,对木? 这个方法的调用有神马后果呢?求知道:)
Spring只是帮你注入你xml中写好的,那些xml文件没有写的,仍然是需要自己创建或调用的。
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
...
</param-value>
</context-param>
这些是配置上下文变量的么?
ContextLoaderListener硬编码,只读取contextConfigLocation变量?
不能让ContextLoaderListener读其他变量么?
public interface ServletContextListener extends EventListener {
/**
** Notification that the web application initialization
** process is starting.
** All ServletContextListeners are notified of context
** initialization before any filter or servlet in the web
** application is initialized.
*/ public void contextInitialized ( ServletContextEvent sce ); /**
** Notification that the servlet context is about to be shut down.
** All servlets and filters have been destroy()ed before any
** ServletContextListeners are notified of context
** destruction.
*/
public void contextDestroyed ( ServletContextEvent sce );
}
ContextLoaderListener extends ContextLoader implements ServletContextListener
在web.xml中配置ContextLoaderListener,会导致容器在启动时调用ContextLoaderListener的contextInitialized方法,对木? 这个方法的调用有神马后果呢?求知道:)