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

web工程初始化spring容器, 并读入总配置文件

2011-12-02 13:55 423 查看
webapp/WEB-INF/web.xml:

<?xml version="1.0" encoding="UTF-8"?>

<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">

<display-name>service</display-name>

<!--配置文件-->

<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>

</web-app>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: