spring 的在web 工程中加载

spring 的在web 工程中加载

ID:12654681

大小:43.50 KB

页数:8页

时间:2018-07-18

spring 的在web 工程中加载_第1页
spring 的在web 工程中加载_第2页
spring 的在web 工程中加载_第3页
spring 的在web 工程中加载_第4页
spring 的在web 工程中加载_第5页
资源描述:

《spring 的在web 工程中加载》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库

1、Spring 的在WEB 工程中加载(2009-03-2314:08:32)标签:it分类:spring在Web工程中启动Spring2.0的三种方法:(一)利用Spring自带的Listener(推荐)-org.springframework.web.context.ContextLoaderListener=======================================配置如下:在web.xml中配置spring框架所需要的配置内容contextC

2、onfigLocation------------固定的内容/WEB-INF/classes/spring.xml-创建的spring的配置文件的路径     org.springframework.web.context.ContextLoaderListener   配置完毕,可以启动spring容

3、器了!==============(二)利用Spring自带的servlet-org.springframework.web.context.ContextLoaderServlet 配置如下: 在web.xml中配置spring框架所需要的配置文件 contextConfigLocation------------固定的内容 /WEB-INF/classes/spring.xml---

4、-创建spring的配置文件的路径 context--固定的内容     org.springframework.web.context.ContextLoaderServlet  1配置完毕,可以启动spring容器了! 可见上面两种方法来启动Spring都需要

5、配置元素,来指定spring的配置文件的位置。==============(三)利用第三方的WEB框架定义的如:struts框架=========配置如下:在Struts的配置文件中配置文

6、ng.xml"/>配置完毕,可以启动spring容器了! Spring 有连个核心接口:     BeanFactory:BeanFactory是Spring的最基本的接口,     ApplicationContext: BeanFactory的子接口,因此也成为Spring的上下文对象。很多时候不使用BeanFactory,而使用ApplicationContext的实例对象,他增强了BeanFactory的功能。      BeanFactory的实现类很多,主要有:       (1)org

7、.springframework.beans.factory.xml.XmlBeanFactory类;     (2)ApplicationContext(子接口),其实现类有:            org.springframework.context.support.FileSystemXmlApplicationContext;            org.springframework.context.support.ClassPathXmlApplicationContext。(一般使用这个实现类)   

8、   代码片段(1):---定义数据源bean,利用c3p0数据源实现            

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。