Spring|Spring环境搭建
Spring环境搭建
一、下载 spring jar 包
复制到 src 下,并增加到类路径Build path-add to build path
http://maven.springframework.org/release/org/springframework/spring/
http://commons.apache.org/
二、编写配置文件(为了编写时有一些提示、自动生成一些配置信息,而非直接的xml)
方法一:增加 sts 的插件,给 eclipse增加支持 spring 的插件,下载后在 spring tool suite 中进行安装
https://spring.io/tools3/sts/all
方法二:直接下载 sts 工具,相当于继承了spring tools 的 eclipse ,用法和 eclipse 一模一样
https://spring.io/tools3/sts/legacy
新建 Spring Bean Configuration File ,名字请叫做“applicationContext.xml”
三、开始开发程序
新建一个 Teacher.java ,包括一些属性,有set,get
新建一个 Course.java ,包括一些属性,有set,get
将两者的信息以 bean 的形式加入到配置文件 applicationContext.xml中