Spring framework in a detailed

Source: Internet
Author: User

Put together a copy of the spring framework you shared before.

Overall architecture:

Spring is a lightweight control inversion (IoC) and facet-oriented (AOP) container framework

Frame Diagram (selected from: http://docs.spring.io/spring/docs/3.0.x/reference/overview.html):

Core container is the heart of spring and implements the IOC-based bean management container. The upper-level aop/aspects are based on the AOP that is implemented on his basis. They form the core function of spring.

On the basis of IOC and AOP, we have expanded the data layer and the Web layer

Usage scenarios:

Web App Usage Scenario: (SPRINGMVC + Spring)

RPC App Usage Scenarios:

IOC definition:

Applying control inversion, when an object is created, it is passed to it by an external entity that regulates all objects within the system, and references the object to which it depends. It can also be said that the dependency is injected into the object. So, control reversal is a reversal of this responsibility about how an object obtains a reference to the object he relies on.

The class relationship of the IOC container framework:

Compared to Beanfactory and ApplicationContext, ApplicationContext supports more features:

ApplicationContext supports different sources of information: ApplicationContext expands the Messagesource interface to support internationalization implementations.

Access to resources: ApplicationContext inherits Defaultresourceloader subclasses, providing support for Resourceloader and resource

Support for application events: ApplicationContext inherits the Applicationeventpublisher interface

ApplicationContext Start Process (abstractapplicationcontext):

Configurablelistablebeanfactory beanfactory = Obtainfreshbeanfactory ();//Invoke factory processors registered as beans In the Context.invokebeanfactorypostprocessors (beanfactory);//Register bean processors that intercept bean Creation.registerbeanpostprocessors (beanfactory);//Instantiate all remaining (Non-lazy-init) Singletons.finishbeanfactoryinitialization (beanfactory);

  

Bean Description:

Sort by the type of injected bean:

Divided into ordinary beans and Factorybean

Factorybean needs to implement the Factorybean interface, which is applied to a bean as a factory method to produce different bean instances, often used in the construction of the application Layer framework, which can return different implementations of the interface according to specific conditions

 Public Interface Factorybean<t> {    throws  Exception;        Class<?> getobjecttype ();     Boolean Issingleton ();}

How the Bean's resource definition is loaded into the container:

Xmlbeanfactory:

ApplicationContext

Ways to get a bean programmatically

Configuration of the Web application bean instantiation

Register the Bean:

How to customize Bean labels

Beanfactorypostprocessor

To get the process of the bean:

Bean's life cycle

Extension in the life cycle

How spring starts in the Web

Note for beans

Annotation implementation examples

Problem Interaction:

Will the Bean's cyclic dependency be an error?

How to extend the definition label for a bean

When does the Web ApplicationContext instantiate the bean

AOP definition

It is a technology to realize the unified maintenance of program function by pre-compiling and running-time dynamic agent for slicing programming.

Application Mode

Implementation principle

WEBX Introduction

Spring Framework Detailed

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.