问下:)

解决方案 »

  1.   

    web.xml中最多可以配置多少个Listener呢?
      

  2.   

    当然可以了。
    Spring只是帮你注入你xml中写好的,那些xml文件没有写的,仍然是需要自己创建或调用的。
      

  3.   


    <context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>
    ...
    </param-value>
    </context-param>
    这些是配置上下文变量的么?
    ContextLoaderListener硬编码,只读取contextConfigLocation变量?
    不能让ContextLoaderListener读其他变量么?
      

  4.   

    ContextLoaderListener的作用就是启动Web容器时,自动装配ApplicationContext的配置信息。因为它实现了ServletContextListener这个接口,在web.xml配置这个监听器,启动容器时,就会默认执行它实现的方法。至于ApplicationContext.xml这个配置文件部署在哪,如何配置多个xml文件,书上都没怎么详细说明。现在的方法就是查看它的API文档。在ContextLoaderListener中关联了ContextLoader这个类,所以整个加载配置过程由ContextLoader来完成。
      

  5.   


    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方法,对木? 这个方法的调用有神马后果呢?求知道:)