Spring Core Components
Spring has many core components, but its skeleton is Core, Context and Bean.
Bean
Among the three, Bean is the core of the core. Beans implement objects through configuration files, and Spring manages object storage space and life cycle allocation. Through dependency injection, objects can be injected into specified business logic classes. These injection relationships are managed by the Ioc container.
Therefore, the core idea of Spring is often called BOP (Bean Oriented Programming), Bean-oriented programming.
Bean component is defined under Spring's org.springframework.beans package, which solves the following problems:
Definition of Bean
Creation of Bean
Parsing of Bean
Users only need to pay attention to the creation of Bean, other Both processes are completed internally by Spring.
1. Overall architecture
The overall architecture of Spring Bean is a typical factory model, and the top-level interface is BeanFactory. ListableBeanFactory, HierarchicalBeanFactory and AutowireCapableBean are its subclasses in order to distinguish the data limitations of Spring's internal object processing and conversion.
ListableBeanFactory: Indicates that these beans are listable
HierarchicalBeanFactory: Indicates that these beans have an inheritance relationship
AutowireCapableBeanFactory: Defines the automatic assembly rules of beans
These interfaces respectively define Bean collections, Bean relationships and Bean relationships. Behavior.
2.Bean definition
Bean definition is mainly described by BeanDefinition, and the hierarchical relationship is as follows:
The nodes defined in Spring’s configuration file will be converted into BeanDefinition objects after successful parsing, and all subsequent operations will be performed on Performed on BeanDefinition object.
3.Bean parsing
The main task of Bean parsing is to parse the Spring configuration file and finally generate the BeanDefinition object.
The parsing process is very complex, including all tags in the configuration file. The main participating classes are as follows:
Context
Bean wraps Objects, and Objects store the data required by the business. Therefore, how to provide a survival and operating environment for these data and the relationships between them (that is, saving the state of the object) is the problem that Context needs to solve. Context is actually a collection of Bean relationships, also called an Ioc container.
ApplicationContext is the top-level interface of Context. The hierarchical relationship is as follows:
ApplicationContext can identify the basic information of an application environment. It inherits 5 interfaces to expand the functions of Context. Among them, BeanFactory is used to create beans, and it inherits ResourceLoader interface for accessing any external resources.
Subclasses of ApplicationContext, mainly include:
ConfigurableApplicationContext: A Context in which users can dynamically configure and modify information, among which AbstractRefreshableApplicationContext is the most commonly used.
WebApplicationContext:
Context prepared for web applications, which can directly access ServletContext.
In short, the functions that ApplicationContext must complete are as follows:
Identify an application environment
Use BeanFactory to create Bean objects
Save object relationship tables
Capture various events
As an Ioc container, Context is responsible for most other functions of Spring Base.
Core
Spring is a package of tools for discovering, establishing and maintaining relationships between beans, called Core. This is actually the required Util.
One of the important components of Core is Resource.
1. Overall level of Resource
Resource mainly defines the access method of resources. All resources are abstracted into the Resource interface. The hierarchical relationship is as follows:
Resource packaging. Resource inherits the InputStreamSource interface upwards, and all resources are obtained through InputStream, thereby shielding the resource provider.
Resource loading. ResourceLoader interface under Resource, all resource loaders can load all resources by uniformly implementing this interface, such as the previous ApplicationContext.
2. Establish a relationship with Context
As shown in the figure, ApplicationContext interacts with ResourceLoader through the ResourcePatternResolver interface to load, parse and describe resources. ResourcePatternResolver encapsulates and integrates resources to facilitate use by other components.
Summary
This article mainly summarizes the three core components that constitute the Spring skeleton framework and the connections between them, as well as some insights into the understanding of the implementation principles of the three.

Is it enough to learn Python for two hours a day? It depends on your goals and learning methods. 1) Develop a clear learning plan, 2) Select appropriate learning resources and methods, 3) Practice and review and consolidate hands-on practice and review and consolidate, and you can gradually master the basic knowledge and advanced functions of Python during this period.

Key applications of Python in web development include the use of Django and Flask frameworks, API development, data analysis and visualization, machine learning and AI, and performance optimization. 1. Django and Flask framework: Django is suitable for rapid development of complex applications, and Flask is suitable for small or highly customized projects. 2. API development: Use Flask or DjangoRESTFramework to build RESTfulAPI. 3. Data analysis and visualization: Use Python to process data and display it through the web interface. 4. Machine Learning and AI: Python is used to build intelligent web applications. 5. Performance optimization: optimized through asynchronous programming, caching and code

Python is better than C in development efficiency, but C is higher in execution performance. 1. Python's concise syntax and rich libraries improve development efficiency. 2.C's compilation-type characteristics and hardware control improve execution performance. When making a choice, you need to weigh the development speed and execution efficiency based on project needs.

Python's real-world applications include data analytics, web development, artificial intelligence and automation. 1) In data analysis, Python uses Pandas and Matplotlib to process and visualize data. 2) In web development, Django and Flask frameworks simplify the creation of web applications. 3) In the field of artificial intelligence, TensorFlow and PyTorch are used to build and train models. 4) In terms of automation, Python scripts can be used for tasks such as copying files.

Python is widely used in data science, web development and automation scripting fields. 1) In data science, Python simplifies data processing and analysis through libraries such as NumPy and Pandas. 2) In web development, the Django and Flask frameworks enable developers to quickly build applications. 3) In automated scripts, Python's simplicity and standard library make it ideal.

Python's flexibility is reflected in multi-paradigm support and dynamic type systems, while ease of use comes from a simple syntax and rich standard library. 1. Flexibility: Supports object-oriented, functional and procedural programming, and dynamic type systems improve development efficiency. 2. Ease of use: The grammar is close to natural language, the standard library covers a wide range of functions, and simplifies the development process.

Python is highly favored for its simplicity and power, suitable for all needs from beginners to advanced developers. Its versatility is reflected in: 1) Easy to learn and use, simple syntax; 2) Rich libraries and frameworks, such as NumPy, Pandas, etc.; 3) Cross-platform support, which can be run on a variety of operating systems; 4) Suitable for scripting and automation tasks to improve work efficiency.

Yes, learn Python in two hours a day. 1. Develop a reasonable study plan, 2. Select the right learning resources, 3. Consolidate the knowledge learned through practice. These steps can help you master Python in a short time.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

Notepad++7.3.1
Easy-to-use and free code editor

WebStorm Mac version
Useful JavaScript development tools

Dreamweaver Mac version
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)