首页 > 代码库 > contextLoaderListener
contextLoaderListener
contextLoaderListener的作用,在启动的时候,自动装载applicationcontext.xml文件。
contextloaderListener实现了servletContextListener接口,在web.xml中配置这个方法,在tomcat启动时就会默认执行它实现的方法。
contextLoaderListener中关联了contextLoader这个类,所以整个加载配置过程由contextLoader来完成,
部署applicationcontext.xml,如果不写任何配置信息,那么默认路径是WEB_INF/Applicationcontext.xml
如果是自定义路径名,那么可以在web.xml中加上contextconfigLocation这个context参数。
<context-param>
<param-name>contextconfigLocation</param-name>
<param-value>
WEB_INF/classes/applicationcontext*.xml
</param-value>
</context-param>
applicationcontext*.xml通配符,匹配所有以applicationContext开头,.xml结尾的文件。
contextLoaderListener
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。