Spring primary article - concept (2) (spring interview basic questions)

Original link https://blog.csdn.net/KamRoseLee/article/details/79606913

1. What are the technologies that mainly use Spring in development?

    ①: The IOC container manages the components of each layer

    ②: Declare transactions using AOP configuration

    ③: Integrate other frameworks

2. Briefly describe the concepts of AOP and IOC

    AOP: Aspect Oriented Program, programming for (aspect) aspect; Filter (filter) is also a kind of AOP. AOP is a new methodology that complements traditional OOP (Object Oriented Programming). The main programming object of AOP is the aspect (aspect), and the aspect modularizes the cross-cutting concern.

    IOC: invert of control, inversion of control. Also known as DI (Dependency Injection) The idea is to reverse the direction of resource acquisition. The traditional resource search method requires the component to initiate a request to the container to find the resource. In response, the container returns the resource in due time. After IOC is applied, the container actively pushes resources to the components it manages. All the components have to do is choose a suitable way to receive resources. This behavior is also called the passive form of lookup.

3. How to configure beans in Spring?
Bean configuration method: through the full class name (reflection), through the factory method (static factory method & instance factory method), FactorBean)

4. The life cycle of the Bean by the IOC container:
①: Create a Bean instance through the constructor or factory method
② : To set the value of the bean's attributes and reference to other beans
③: Pass the Bean instance to the postProcessBeforeInitialization method of the Bean post-processor
④: Call the Bean's initialization method (init-method)
⑤: After passing the Bean instance to the Bean Set the processor's postProcessBeforeInitialization method
⑥: Bean can be used
⑦: When the container is closed, call the Bean's destroy method (destroy-method)

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326449826&siteId=291194637