(Ps: So the notes are just to record my personal learning records, and I study with the crazy god of station b, so it may be easier!)
1. Spring starts
1.1 Introduction
- Spring :( Author: Rod Johnson)
- In 2002, the embryonic form of the Spring framework was launched for the first time ------interface21 framework
- On March 24, 2004, Spring was developed based on the interace21 framework, and now 1.0 is officially released
- Spring download the latest website: click here to enter the download official website
- Spring's philosophy: to make the existing technology easier to use is a hodgepodge in itself, integrating the existing technology framework.
- SSH:Struct2 + Spring + Hibernate
- SSM:Spring + Spring MVC + Mybatis
Spring download address on Github
Spring download address in Maven
The following two are the dependent xml code of spring-mvc and spring-jdbc (this is required for import configuration)
<!-- https://mvnrepository.com/artifact/org.springframework/spring-webmvc -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>5.2.12.RELEASE</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework/spring-webmvc -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>5.2.12.RELEASE</version>
</dependency>
The pom.xml configuration file in the maven project(I use the 5.2.12 version of Spring)
1. IDEA creates a Maven project
2. Configure maven in IDEA
3. Open the pom.xml file, add dependency configuration, below is my configuration code (version can be chosen by myself, I choose version 5.2.12 of Spring)
<?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>org.example</groupId>
<artifactId>spring-study-01</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
<dependencies>
<!-- https://mvnrepository.com/artifact/org.springframework/spring-webmvc -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>5.2.12.RELEASE</version>
</dependency>
</dependencies>
</project>
4. If the option of import chance pops up in the lower right corner of IDEA, click on it. It may take some time here. IDEA is helping you download Spring related files from the Maven warehouse.
If you find it annoying to pop up "import chance" every time, you can let IDEA automatically confirm the change
1.2, advantages
-
Spring is an open source free framework (container)
-
Spring is a lightweight, non-invasive framework!
-
Inversion of Control (IOC), Aspect Oriented Programming (AOP)
-
Support transaction processing, support for framework integration
To sum up: Spring is a lightweight, inversion of control (IOC) and aspect-oriented programming (AOP) framework
1.3, Spring composition
This picture is taken from the official website, the core point
1.4. Expansion
Spring official website has such an introduction: modern java development! To put it bluntly, it is based on Spring development
-
Spring Boot:
- A scaffold for rapid development
- A single microservice can be quickly developed based on Spring Boot
-
Spring Cloud:
- Spring Cloud is based on Spirng Boot
Most companies are now using SpringBoot for rapid development. The prerequisite for learning Spring Boot requires a complete mastery of Spring and Spring MVC, which is a link between the previous and the next.
Disadvantages: After developing for too long, it violated the original idea! Configuration is very cumbersome, known as "configuration hell"
This issue (to be honest, there is nothing to say _ ) will be introduced here, and the next issue will continue!