您的位置:首页 > 编程语言 > Java开发

spring配置文件路径修改后web.xml配置

2013-05-14 09:19 411 查看
在web.xml中加入

<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>


这样系统会自动读取/WEB-INF/applicationContext.xml

如果自己定义文件名,还需要增加

<context-param>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:applicationContext.xml</param-value>
</context-param>
</context-param>


此时的applicationContext.xml在src目录下
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: