Blog friends who have read the "fate series" know that this is a battle for the Holy Grail between seven heroic spirits. Today we will mainly talk about the container concept of the Holy Grail in order to understand spring.
Holy Grail:
The Holy Grail itself has no entity. Instead, it uses beings (people) with magic circuits as "containers" to pass through Appears as a ghost to the "vessel" that collects the souls of Servants.
The function of the Holy Grail:
Give all your wishes to the container of the Holy Grail to realize them
The realization of the Holy Grail:
1. In the land controlled by the Tohsaka family, there is a piece of land called "Fuyuki Town" that is connected to a source of magic power that is so huge that it can be called endless.
2. In order to use these magic powers, in addition to the huge magic circle on the surface, two necessary conditions are required: a key to open the magic circle, and a flow tube to export the magic power.
3. Talking about the specific realization, it is to gather the magic power contained in the seven heroic spirits, use it as the key to activate the magic circle, and then export the magic power through the Holy Grail.
The source of magic power of "Holy Grail Summoning".
Spring:
##Spring framework is a very powerful Inversion of control (IOC, Inversion of control) framework.
The role of spring:
## The object is created by new and handed over to the spring container for implementation, thereby achieving inversion control
The implementation of spring:
The basic concept of the Inversion of Control pattern (also called dependency injection) is: not to create objects, but to describe how to create them. It is not directly connected to objects and services in the code, but which component requires which service is described in the configuration file. The container (in the Spring framework, the IOC container) is responsible for tying these together. In a typical IOC scenario, the container creates all the objects and sets the necessary properties to connect them together and decide when to call methods. The following table lists one implementation mode of IOC.
Services need to implement special interfaces. Through the interfaces, these services are provided by objects, which can be obtained from Object query dependencies (e.g., required additional services) [interface injection]. | |
Assign dependencies through JavaBean properties (such as setter methods) [setter method injection]. | |
Dependencies are provided as constructors and are not exposed as JavaBean properties [Construct device injection]. |
The above is the detailed content of Explain spring with Holy Grail fun. For more information, please follow other related articles on the PHP Chinese website!