ContextLoaderListener的作用
在启动Web容器时,ContextLoaderListener监听器会自动装配applicationContext.xml的信息。因为ContextLoaderListener实现了ServletContextListener接口,在Web.xml中要配置这个监听器。
因此,在启动Web容器时需要一些初始化信息,就可以继承ContextLoaderListtenner实现。
在启动Web容器时,ContextLoaderListener监听器会自动装配applicationContext.xml的信息。因为ContextLoaderListener实现了ServletContextListener接口,在Web.xml中要配置这个监听器。
因此,在启动Web容器时需要一些初始化信息,就可以继承ContextLoaderListtenner实现。