web中如何spring如何配置

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

spring会默认在WEB-INF目录下查找applicationContext.xml文件

如果有多个配置文件

<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
classpath:applicationContext-hibernate.xml
<!-- classpath:applicationContext-hibernate_jndi.xml-->
classpath:applicationContext-dao.xml
classpath:applicationContext-service.xml
classpath:spring/proxy/system.xml,
</param-value>
</context-param>

 

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

posted @ 2017-09-30 19:54  田园沃土  阅读(403)  评论(0编辑  收藏  举报