Gossip
Let me talk about the Spring advanced framework. I divide the Spring advanced framework into three parts:
- ssh=spring+struts+hibernate
- ssm=spring+springmvc+mybatis
- spring family bucket = scaffolding framework springboot, microservice framework springcloud, etc.
Today I’m going to talk about the high-level spring source code . Reading the source code is definitely a time-consuming and laborious task, which requires readers to spend a lot of time to complete, but once you do it seriously, you can better master the framework; better Deal with problems or bugs in the code; at the same time, one step further away from the architect.
Spring is a lightweight framework with very clear layers and clear dependencies and responsibilities. It mainly includes several large modules:
- Data processing module
- Web module
- AOP (Aspect Oriented Programming) /Aspects模块
- Core Container module and Test module
Spring relies on these basic modules to realize a pleasant zero-intrusion lightweight framework that integrates existing solutions.
Not much to say, let’s take the cocoon with Google, tear up the core parts of spring, thoroughly read the spring source code, and understand the framework. This article is divided into seven parts with more content. The editor below will show you in the form of text + screenshots. For source code notes, please [forward+follow] the private message keyword "source code" for free!
Spring overview
- Introduction to Spring
Spring is a hierarchical full-stack (full-stack) lightweight open source framework. With IoC and AOP as the core, it provides many enterprise-level application technologies such as the presentation layer SpringMVC and business layer transaction management. It can also integrate many famous open source worlds. The third-party frameworks and class libraries have become the most used open source framework for Java EE enterprise applications.
- Spring development history
- Advantages of Spring
- The core structure of Spring (as shown below)
- Spring framework version
The core idea of Spring
IOC and AOP are not proposed by spring, they existed before spring, but they are more theoretical. Spring has implemented these two ideas very well at the technical level (Java)
IoC
- What is IoC
- What problem does IoC solve
- The difference between IoC and DI
AOP
- What is AOP
- What problem is AOP solving
- Why is it called aspect-oriented programming
Implement IoC and AOP by hand
In the last part, we understood the ideas of IoC and AOP. Let's not consider how Spring implements these two ideas. Here is a case of [Bank Transfer]. Please analyze what is wrong with this case at the code level? Use our existing knowledge to solve these problems (pain points) after analysis. In fact, in this process, we are analyzing and implementing IoC and AOP by hand.
- Bank transfer interface
- Bank transfer case table structure
- Bank transfer case code call relationship
- Key code of bank transfer case
- Analysis of bank transfer case code problems
- Problem solving ideas
- Case code transformation
Spring IOC application
Spring IoC basics
- The difference between BeanFactory and ApplicationContext
- Pure xml mode
- xml and annotation combined mode
- Pure annotation mode
Spring IOC advanced features
- lazy-Init lazy loading
- FactoryBean 和 BeanFactory
- Post processor
Deep analysis of Spring IOC source code
Spring IoC container initialization main process
- Spring IoC container system
- Key timing points in the Bean life cycle
- Spring IoC container initialization main process
BeanFactory creation process
- Get BeanFactory sub-process
- BeanDefinition loading analysis and registration sub-process
Bean creation process
Principle of lazy-init lazy loading mechanism
Spring IoC circular dependency problem
- What is circular dependency
- Circular dependency handling mechanism
Spring AOP application
The essence of AOP: Enhance the cross-cutting logic without changing the original business logic. The cross-cutting logic code is often permission verification code, log code, transaction control code, and performance monitoring code.
AOP related terms
- Main line of business
- AOP terminology
Proxy selection of AOP in Spring
How to configure AOP in Spring
AOP implementation in Spring
- XML schema
- XML + annotation mode
- Annotation mode
Spring declarative transaction support
Deep analysis of Spring AOP source code
Proxy object creation
- AOP basic use case preparation
- Timing analysis
- Proxy object creation process
Spring declarative transaction control
- @EnableTransactionManagement
- Load transaction control component
to sum up
This high-level Spring source code note that is full of dry goods is summarized by the South China Google architect. This big man's understanding of the Spring framework is really and has reached a "horrible pervert" point. I still read it before. I have seen a video of this big guy, it's very nb, kneel down!
Friends who want to quickly [forward+follow+comment] support it, and then privately write the keyword "source code" to get a free download! First come first served!