4
头图

Author: Xiao Fu Ge
Blog: https://bugstack.cn

Precipitate, share, and grow, so that you and others can gain something! 😄

I. Introduction

Not serious! To write the Scriptures, go to the Spring source code 🌶?

Yes, after writing 4 articles about Spring's core source code, I decided to pick up a Spring. Why do you do this? Because all the content I want to write, I hope that it is learned for the purpose of scientific thinking and understanding, rather than memorized by hard memorization. And the content analysis of each Spring source code involved in the current scriptures, even after removing some of the non-mainstream logic, will still appear to be very large. can still be read several times for experienced drivers, but as far as newcomers are concerned, they can only be put in their favorites and eat ashamed!

May have read 2.5K downloads of "Java side by manual" small partner will know, this is an interview entitled to explain the entrance of the core Java technology books, the book content that you tried to confirm The code is the concrete realization of mathematical logic. When you read the books carefully, you will find that there is a lot of mathematical knowledge in Java, including: perturbation function, load factor, zipper addressing, open addressing, Fibonacci hashing, and the use of golden section points and many more.

Therefore, when writing the face-to-face manual about the Spring series, I also hope that it is a summary of technical information and value that is beneficial to the real growth of programmers, not just a list of a series of complicated contents. Then learn from tiny-spring ), mini-spring and my experience of learning Spring and often tossing to develop middleware, to write a Spring material that is suitable for my own precipitation and also satisfied with everyone's learning.

160a5c9b3da8b7 Fu Ge's face sutras are all "fake", as soon as he comes up good! Since you said that, next we define the target, the plan, and start source code!

2. Goal

The purpose of this repository is to learn the Spring source code. By taking the readers a little hand-written simplified version of the Spring framework to understand the core principles of Spring, and lay the foundation for subsequent in-depth learning of Spring.

In the process of handwriting, the complicated content in the Spring source code will be removed, the core logic in the overall framework will be extracted, the code implementation process will be simplified, and the core functions will be retained, such as: IOC, AOP, Bean life cycle, context, scope, resource processing, etc. Content realization.

All the content realization will start with Jane and lead everyone to realize it step by step. Finally, after all the content is completed, a relatively complete small-spring will be provided. As long as you can follow along in this process, then you will be able to compare in the end. It's easy to read the Spring source code.

Three, plan

It was scheduled to have prepared articles related to the Spring AOP filter notifier this week, and the source code has been compiled. But I found out that if I post it like this, I guess the amount of reading will be split, and most of them are in the favorites.

The biggest hope of writing an article is to interact with readers, not afraid of your comments, but afraid that you will not give it to Sanlian! All the comments, comments, likes, and shares given by readers are 120 steps of the next article, so after finishing the source code of this article, I decided to organize Spring, not only for me There is a sense of precipitation in the learning process, so that readers can really learn this part of the content. back, that's a eight-legged essay, you can get the posture if you understand it!

To be reasonable, in fact, I am also a master who is willing to use the source code, because from the source code learning, I can get some technical content that is unlikely to be exposed during the development of business systems. And this part of the technical content learned from the source code can be reused in business system development. For example, many middleware and design patterns I have written all come from the mining and application of the content of the framework source code.

How much is the source code of the Spring framework?

Up to now, the case source code of the four chapters has been written, mainly including: container creation, Bean definition and registration, construction of examples, and attribute filling. Because the initial content is relatively simple, it will be faster to write. The directory structure is as follows, and follow up with additional chapters:

  • [x] Chapter 1: Introduction, what can handwriting Spring bring to you?
  • [x] Chapter 2: Spring Bean Container Creation | small-spring-step-01
  • [x] Chapter 3: Spring Bean Definition and Registration | small-spring-step-02
  • [x] Chapter 4: Spring Bean constructor instantiation strategy and Cglib dynamic generation and use | small-spring-step-03
  • [x] Chapter 5: Filling Bean Objects with Attribute Information | small-spring-step-04
  • [] Chapter 6: To be archived...

From my point of view, it is faster to write the source code than to write an article. Even if it is a very simple knowledge point, it is necessary to introduce neither complicated or redundant introduction, but also to explain the breadth and depth of knowledge clearly. So in the process, I will also read a lot of materials and documents on the official website, and finally show the valuable content that is in line with the current chapter for readers to learn. At the same time, this is also an accumulation of personal technical content.

Fourth, the source code

This chapter is the of the entire 160a5c9b3dacf6 Spring hand-painted column, so here is the source code address and how to learn to use it to the readers, so that everyone can learn this part of the content smoothly in the follow-up.

  • Source directory: https://github.com/fuzhengwei/small-spring - summary articles, source code, visio, xmind, ppt, etc. including finishing content creation process to allow readers to learn
  • Source realization: https://github.com/small-spring - dismantling implementation steps, build tissue engineering, source code showing the specific implementation of each chapter, if you are willing to get involved in the project construction

Five, summary

  • When you read the Spring source code, you will see all kinds of nesting, recursion, proxying, and you may not even know where to hit the breakpoint when you want to debug, and the running program jumps around. In the end, I couldn't stand the source code anymore! This is because Spring has been developed for too long. In order to meet different scenarios, it has made too many supplements and optimizations. So what we have to do is to peel off the cocoon, reflect the core, and reflect the most directly related content. Learning is easier to understand.
  • In the process of learning the source code, Xiao Fu will start with you from the simplest and simplest bean container. Sometimes there may not be too much content in some chapters, but I will help you establish some knowledge associations as much as possible. Let you gain more in this learning process.
  • So that is the Spring hand-painted column. Then you can read the article and get the source code, until we have all the content completed, then we can develop a relatively complete Spring framework. Up. I hope you and I will continue to learn to punch cards during this process!

Sixth, series recommendation


小傅哥
4.7k 声望28.4k 粉丝

CodeGuide | 程序员编码指南 - 原创文章、案例源码、资料书籍、简历模版等下载。