Spring interview, understanding of IOC and AOP

Source: Internet
Author: User

What are the advantages of spring?
1. The coupling between components is reduced, and the decoupling between each layer of software is realized.
2. Can use many services that are easy to provide, such as transaction management, message service, etc.
3. The container provides a singleton mode support
4. The container provides AOP technology, it is easy to implement such as permission interception, run-time monitoring and other functions
5. The container provides many auxiliary classes, which can accelerate the development of the application
6.spring provides integrated support for mainstream application frameworks, such as Hibernate,jpa,struts
7.spring is a low-intrusive design with very low code pollution
8. Independent of various application servers
The 9.spring di mechanism reduces the complexity of business object substitution
10.Spring is highly open and does not force applications to rely entirely on spring, and developers are free to select part or all of spring

What is a di mechanism?
Dependency Injection (Dependecy injection) and control inversion (inversion of controls) are the same concept, specifically: when a role
When another role assistance is required, the caller's instance is typically created by callers during the traditional program design process. But in spring,
The work of creating the callee is no longer done by the caller, so it is called control reversal. 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.

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.

The two characteristics of an AOP framework are:
1. Good isolation between the various steps
2. Source code Independence

Spring interview, understanding of IOC and AOP

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.