Spring Series Frame System review (ii) Spring Principle-interview frequently encountered problems

Source: Internet
Author: User
Tags aop

1. What is a di mechanism?

Dependency Injection (Dependecy injection) and control inversion (inversion of controls) are the same concept, specifically: when a role needs another role to assist, in the traditional program design process, An instance of the callee is typically created by the caller. But the work of creating the callee in spring is no longer done by the caller, so called control inversion. The work of creating the callee is done by spring and then injected into the caller

Therefore also known as dependency injection.
Spring manages objects in a dynamic and flexible manner, injecting two ways, setting injection and constructing injection.
Advantages of setting Injection: intuitive, natural
Advantages of construct injection: You can determine the order of dependencies in the constructor.

2. What is AOP?

Aspect-oriented programming (AOP) to improve spring's dependency injection (DI), aspect-oriented programming in spring is mainly represented in two aspects
1. To provide declarative transaction management for tangent-oriented programming
2.spring supports user-defined facets

Facet-oriented programming (AOP) complements object-oriented programming (OOP),
Object-oriented programming breaks down programs into objects of all levels, and the program runs the process into facets.
AOP considers the structure of the program from the point of view of the program, extracts the facets of the business process, and OOP is a static abstraction, and AOP is a dynamic abstraction.
is to abstract the steps in the application execution process, thus obtaining the logical division between the steps.

3. How Spring Works

Front-end Controller (dispatcherservlet): Receives the request, responding to the result, equivalent to the computer's CPU.

Processor Mapper (handlermapping): To find the processor based on the URL

Processor (Handler): (Requires programmer to write code processing logic)

Processor Adapter (Handleradapter): The processor will be packaged as an adapter, so that it can support multiple types of processors, Analog notebook adapter (adapter mode application)

View Resolver (Viewresovler): For view resolution, multiple returned strings, processed, can be parsed into corresponding pages

First step: The user initiates the request to the front controller (dispatcherservlet)

Step Two: Front Controller request processor Mapper (handlermappering) to find the processor (Handle): Find by XML configuration or annotations

Step three: Find the processor mapper (handlermappering) as the front controller returns to the execution chain (handlerexecutionchain)

Fourth step: The Front controller (Dispatcherservlet) calls the processor adapter (Handleradapter) to execute the processor (Handler)

Fifth Step: Processor adapter to perform handler

Sixth step: Handler execution to the processor adapter return Modelandview

Seventh Step: The processor adapter returns Modelandview to the front-end controller

Eighth step: The front controller requests the View parser (Viewresolver) to carry out the visual diagram analysis

Nineth Step: View resolver like Front controller return view

Tenth step: Front Controller renders view

11th Step: Front controller responds to user results

Original address: https://www.cnblogs.com/xiaoxi/p/6164383.html

Spring Series Frame System review (ii) Spring Principle-interview frequently encountered problems

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.