一、Web开发技术
从学习角度来说,理解技术问题要越透彻越好,被屏蔽或被封装起来的信息要越少越好。从工程实现角度来说,要尽量高效地使用现成框架和现成工具——这是“学习”和“工程实现”的差别,但这两件事并不矛盾,我们学习得越透彻,在工程实现时,对框架和工具的使用就越高效。
二、Spring框架
目前(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
三、创建Spring应用程序 - 骑士完成任务
(一)创建Maven项目
创建Maven项目 - SpringDemo
,设置项目位置以及组ID
单击【Finish】按钮
修改项目的Maven配置
(二)添加Spring依赖
在Maven仓库里查找Spring框架(https://mvnrepository.com)
选择最新版本 - 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>
<artifactId>spring-core</artifactId>