Spring框架

(一)Spring官网

 Spring Framework - Spring Framework

目前(2022-5-27)Spring Framework版本是5.3.20
(二)Spring框架优点
Spring makes Java productive.
Spring makes Java reactive.
Spring makes Java cloud-ready.
Spring makes Java simple.
Spring makes Java modern.
(三)为什么要选择Spring?
Spring makes programming Java quicker, easier, and safer for everybody. Spring’s focus on speed, simplicity, and productivity has made it the world's most popular Java framework.

“We use a lot of the tools that come with the Spring framework and reap the benefits of having a lot of the out of the box solutions, and not having to worry about writing a ton of additional code—so that really saves us some time and energy.” —— SEAN GRAHAM, APPLICATION TRANSFORMATION LEAD, DICK’S SPORTING GOODS

访问迪克体育用品网站:https://www.dickssportinggoods.com

  • Spring框架有两个非常重要的特性:IoC(Inversion of Control - 控制反转)和AOP(Aspect-Oriented Programming - 面向切面编程)。

  • Spring容器其实就是一个Bean工厂,在工厂里通过配置文件或配置类创建各种各样的Bean,然后在Spring应用程序就可以按照名称或类型获取工厂里已经配置好的Bean。下面我们就通过一个具体的案例来了解Spring容器是如何工作的。

(二)创建Maven项目

  • 创建Maven项目 - SpringDemo,设置项目位置以及组ID

  单击【Finish】按钮

修改项目的Maven配置 

(三)添加Spring依赖

 

查看Spring Core 

在这里插入图片描述

选择最新版本 - 5.3.20

 在这里插入图片描述

添加到pom.xml文件的<dependencies>元素里

 在这里插入图片描述

  • 同理添加其他依赖

  • <?xml version="1.0" encoding="UTF-8"?>
    <project xmlns="http://maven.apache.org/POM/4.0.0"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
             http://maven.apache.org/xsd/maven-4.0.0.xsd">
        <modelVersion>4.0.0</modelVersion>

        <groupId>net.huawei.spring</groupId>
        <artifactId>SpringDemo</artifactId>
        <version>1.0-SNAPSHOT</version>

        <dependencies>
            <!--Spring核心-->
            <dependency>
                <groupId>org.springframework</groupId>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值