spring config detail (持续更新中...)

spring config 的一些实用细节。做个小小的总结,会不断更新......

1.contextConfigLocation

<1>.contextConfigLocation 

在web.xml中定义,通过contextConfigLocation 来配置spring,用来定义要载入的spring 配置文件。

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

如果没有指定的话,默认加载/WEB-INF/下的 applicationContext.xml.

如果要配置多个文件,param-value 用 逗号分割。

<2>.ContextLoaderListener

对应 listener 配置

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



你可能感兴趣的:(spring config detail (持续更新中...))