spring入门

spring的配置文件applicationContext.xml的位置是任意的,可以放在classpath下也可以放在webContent下,只需要在web.xml中配置即可

例如:在webContent中则

 1    <context-param>
 2         <param-name>contextConfigLocation</param-name>
 3         <param-value>/WEB-INF/applicationContext.xml</param-value>
 4  
5
</context-param>
6
<!-- 监听器 -->
7
<!-- 配置spring监听器 -->
8
<listener>
9
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
10 </listener>

在classPath下则:注意要添加classPath

   <context-param>
        <param-name>contextConfigLocation</param-name>   
        <param-value>classpath:applicationContext.xml</param-value>
    </context-param>
    <!-- 监听器 -->
    <!-- 配置spring监听器 -->
    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>

 

posted @ 2013-09-13 14:29  s413574930  阅读(86)  评论(0编辑  收藏  举报