Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to parse the spring source code

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

How to carry out spring source code analysis, many novices are not very clear about this, in order to help you solve this problem, the following small series will explain in detail for everyone, there are people who need this to learn, I hope you can gain something.

1. Dependency Injection ICO: Take over the creation of objects (in fact, annotations and reflection principles), and inject references to objects into components that need them!

Container: managing beans and dependencies

The role of dispatchserlvet

4, spring application ask applicationContext responsible for the creation and assembly of objects!

In spring-based apps, your app objects live in spring containers. Spring containers are responsible for creating objects, assembling them, configuring them, and managing their entire lifecycle

Spring containers can be divided into two types: Bean factories (usually not used) and applicationcontexts (also created based on Bean factories)!

7. Several ways to assemble beans!

Notice the life cycle of a Bean.

All beans in the spring application context appear as singletons! (default), but there are other patterns: singleton, prototype, session, request, etc. But the default is a single case! You can use @scope to declare the scope of a Bean. A singleton will only be created once in the same container in spring, and when the bean is obtained later, it will be directly obtained from the singleton cache!

10. AOP's aspect technology is also just a programming aspect technology. The actual execution is still serial!!! Only indirectly through reflective technology. Let developers feel free to insert AOP code into normal business logic!

11. FactoryBean interface implements reflection to create instance beans, hiding the details of bean instantiation!!! Bring convenience to the upper application!!

In spring, BEAN ID should be unique, because these IDs are to create an instance object reference with its name through reflection, if the two IDs are the same, definitely not!

13, the so-called injection is the process of parsing annotations!!

14. The lease of context loader listener is to start the web container and automatically assemble the configuration information of applicationcontext. by loading web.xml!!

Did reading the above help you? If you still want to have further understanding of related knowledge or read more related articles, please pay attention to the industry information channel, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report