Spring框架
Spring是一个轻量级控制反转(IoC)和面向切面(AOP)的容器框架

IOC
控制反转(Inversion of Control)英文缩写为IOC,是一个重要的面向对象编程的法则,来削减计算机程序的耦合问题,也是轻量级Spring框架的核心。控制反转一般分为两种类型,依赖注入(Dependency Injection)简称DI和依赖查找,依赖注入比较广泛。
将对象的创建权反转给spring
基于maven的spring项目构建
开发工具:eclipse
1.新建maven项目
2.在pom.xml上修改JDK版本
<!-- 修改JDK版本 -->
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
3.导入spring的相关文件
<dependencies>
<!-- spring依赖的核心文件 -->
<!-- https://mvnrepository.com/artifact/org.springframework/spring-context -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>5.2.2.RELEASE</version>
</dependency>
<!-- spring的辅助文件 -->
<!-- https://mvnrepository.com/artifact/commons-logging/commons-logging -->
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.2</version>
</dependency>
</dependencies>
3.从网上下载对应版本的sts3插件并添加到eclipse中
从帮助-->关于eclipse处可以查到版本
Eclipse4.7.0对应下载地址:
<meta charset="utf-8">
http://download.springsource.com/release/TOOLS/update/3.8.4.RELEASE/e4.7/springsource-tool-suite-3.8.4.RELEASE-e4.7.0-updatesite.zip
4.添加插件
帮助-->安装新软件

点击添加 ,在location处写入sts3的下载路径(不要解压)点击添加
之后勾选spring相关内容,点击next
第一次安装会有点慢
安装好之后重启eclipse 安装成功的话在窗口-->首选项下可以找到spring

网友评论