Understanding of SpringBoot 3

springboot (microframework) = springmvc (controller) + spring (project management)

As long as you have SpringBoot, it is equivalent to having project management and controllers

The purpose of springboot is to simplify the initial setup and development process of Spring applications.

What is a spring application? For
example, when we are building a system, we also call this system an application. If this application uses Spring's technology stack, we can call this system a Spring application.

When we use SpringBoot, we must configure it in accordance with the agreement of others. (The framework uses a specific way to configure, so that developers do not need to perform prototype configuration)

Insert picture description here
SpringBoot+Spring data jpa is a pure Spring application.

After using SpringBoot, the configuration files of Spring and SpringMVC do not need to be written, it will be automatically configured at startup. (The configuration file equivalent to xml is gone), the mapper file of mybatis is definitely still necessary, here we are talking about the configuration file of Spring.

Conventions in SpringBoot:

Insert picture description here
The first step in using any framework is to introduce the jar package.
Insert picture description here
Insert picture description hereInsert picture description here
Insert picture description here
After importing the dependencies, we will write the SpringBoot configuration file

Insert picture description here
Insert picture description hereThe default is not to support jsp view

Insert picture description here
Insert picture description here

There is no application name by default in SpringBoot application development projects. If you need to use an application name, you must add the following configuration to specify the application name in the configuration file.

SpringMVC is configured with Servlet, view resolver, and some static resource processing.

Insert picture description hereInsert picture description here
Insert picture description here
Insert picture description here
Insert picture description here
Insert picture description here
Splitting of configuration files: https://blog.csdn.net/liulang68/article/details/109120017

Insert picture description here
We write the same parts to the main configuration file, and different parts to different configuration files. We will activate which configuration file in the main configuration file when we use it.

Insert picture description here
Creation object of SpringBoot factory characteristics

The annotation of the component helps us create the object, and then we can call the method of the object as long as we inject it when we use it. (We don't need to create objects ourselves)

Insert picture description here
Insert picture description hereInsert picture description hereInsert picture description here

Insert picture description hereInsert picture description here
There are three injection methods in the Spring framework, including set injection, automatic injection (annotation-based injection), and construction injection.

 Insert picture description here
Insert picture description hereThe above writing is wrong. According to the following map writing,
Insert picture description hereInsert picture description here
Insert picture description here
Insert picture description hereInsert picture description herewe add @autowired to perform the above operation.

Insert picture description hereInsert picture description here
Insert picture description here
jstl is the c tag used in jsp value

Insert picture description here
The next step is to configure the prefix and suffix of the view resolver (just need to be configured in the main configuration file)

Insert picture description hereInsert picture description hereInsert picture description here

Insert picture description here
Insert picture description here
Insert picture description here
Insert picture description here

Insert picture description here
@Accessors annotation usage in lombok:
https://blog.csdn.net/linjpg/article/details/94588483

Insert picture description hereInsert picture description here
Insert picture description hereInsert picture description here
Insert picture description here
Insert picture description hereInsert picture description hereInsert picture description hereInsert picture description here
Insert picture description here

Insert picture description hereInsert picture description here
Insert picture description hereInsert picture description here
Insert picture description here
Insert picture description hereInsert picture description here

Guess you like

Origin blog.csdn.net/liulang68/article/details/109113427