Spring开发环境搭建

版权声明:转载请注明出处 https://blog.csdn.net/chushoufengli/article/details/85650444

1. 把Spring4.0开发需要的jar文件放到lib目录中。

2.

 

 3. Spring的配置文件beans.xml(要放在项目根目录(src)下)

<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN"

"http://www.springframework.org/dtd/spring-beans-2.0.dtd">

注意:配置文件的取名可以是任意的,文件可以存放在任何目录下,但考虑到通用性,一般放在类路径下(也就是Eclipse中项目的src目录下即可) 

4.  测试实例化Spring容器并获取Person的对象

package cn.edu.hezeu.jsj.service.ch07;

import org.springframework.beans.factory.BeanFactory;

扫描二维码关注公众号,回复: 4839376 查看本文章

import org.springframework.beans.factory.xml.XmlBeanFactory;//表示已过时

import org.springframework.context.ApplicationContext;

import org.springframework.context.support.ClassPathXmlApplicationContext;

import org.springframework.core.io.ClassPathResource;

猜你喜欢

转载自blog.csdn.net/chushoufengli/article/details/85650444
今日推荐