Spring Principle in-depth 01: What is Spring? Spring Basic Mechanisms? IOC? AOP
01-What is Spring?
Spring is a lightweight framework, and you will have a lot of unknown terms after Baidu, but these are not important. It is important to understand what changes Spring can make to your daily development, that is
02-What does Spring do?
Spring is used to manage objects for us. The change Spring brings to us is that we don't ...
Posted on Thu, 11 Nov 2021 11:45:01 -0500 by mydimension
Smart implementation of strategy mode with Spring auto-injection
1. Background
In the course of your work, you sometimes need to perform different logic based on different enumerations (constants).
For example, different user types have different methods of handling, the interface is Handler, and the sample code is as follows:
public interface Handler {
void someThing();
}
Some students choose to ...
Posted on Thu, 11 Nov 2021 11:36:56 -0500 by caspert_ghost
Spring source code reading - 1-xml load parsing.md
XML load parsing
1. Load Bean definition
1.1 parsing XML documents
XmlBeanDefinitionReader#loadBeanDefinitions
/**
* Load xml resources, parse all xml tags, encapsulate the bean corresponding to xml as beandefinition (the real type is GenericBeanDefinition), and register
* Returns the number of loaded beandefinitions
*/
public int loadBeanDe ...
Posted on Thu, 11 Nov 2021 05:22:42 -0500 by academy.
What is IOC? Teach you to roll an IOC container
IoC
What is IoC?
IoC is the abbreviation of inversion of control. Note that it is a technical idea. It describes the creation and management of objects.
Traditional development methods: for example, if class a depends on class B, it often creates a new object of class B in class A. IoC development method: we don't need to go to the new obj ...
Posted on Thu, 11 Nov 2021 04:04:13 -0500 by gobbly2100
The current mainstream Spring Boot quickly integrates Swagger
1, Foreword
As the most popular Java web development scaffold, Spring Boot is used by more and more developers to build enterprise RESTFul API interfaces. These interfaces will serve not only the traditional web side (b/s), but also the mobile side. In the actual development process, these interfaces should also be provided to the development ...
Posted on Thu, 11 Nov 2021 02:57:00 -0500 by wtg21.org
Day09 spring November 11, 2021
Spring
1. Spring overview
Spring is an IOC(DI) and AOP container framework
2. Excellent features of Spring
(1) Non intrusive
(2) Control reversal: IOC
(3) Dependency injection: DI
(4) Aspect oriented: AOP extends its functions without modifying the source code
(5) Container: it contains and manages the declaration cycle of application o ...
Posted on Wed, 10 Nov 2021 23:07:22 -0500 by turboprop
Automatic assembly (@ Autowired vs. @ Resource)
Program example (one person has two pets)
Cat class package com.jing.pojo;
public class Cat {
public void shout(){
System.out.println("Meow");
}
}
Dog class package com.jing.pojo;
public class Dog {
public void shout(){
System.out.println("Woof");
}
}
Person class public class Person {
private Cat cat ...
Posted on Wed, 10 Nov 2021 22:54:52 -0500 by Newladder
Interpretation of Spring source code -- Analysis of underlying core concepts
1,BeanDefinition
BeanDefinition represents a Bean definition. There are many attributes in BeanDefinition to describe the characteristics of a Bean. For example:
class: indicates the Bean typeScope: indicates the Bean scope, singleton or prototypelazyInit: indicates whether the Bean is lazy loadedinitMethodName: indicates the method to be exe ...
Posted on Wed, 10 Nov 2021 18:36:14 -0500 by kratsg
Springboot 2 -- principle of automatic assembly
Principle of boot loading configuration class
SpringBoot is started through @ SpringBootApplication. In the previous chapter, we found that after startup, in addition to the components we added to the IOC container, other components were automatically added to the IOC container. We guess they were added through this annotation. Let's take a lo ...
Posted on Wed, 10 Nov 2021 04:59:52 -0500 by dantone
Why can Spring MVC accurately find an http request corresponding to a certain method of the controller for processing
When we annotate the class @ Controller and annotate the method @ RequestMapping in actual development, how does he know the corresponding method when requesting. Before the introduction, first understand how to load the mapped Lu Jin when spring starts.
In Spring MVC, there is an interface HandlerMapping that deals with request mapping, Handl ...
Posted on Tue, 09 Nov 2021 14:11:54 -0500 by swon