Spring is bean-oriented programming that allows the IOC container to manage dependencies between objects through configuration files or annotations. Test A=new Test (); Atul gawande et (); ,

Control of this instantiation is in our hands, and now spring initializes the object using a Spring annotation such as @AutoWired, reversing control to Spring. The IOC container stores Javabeans

@resource (” aaa “) a b IOC container where the id is aaa. @autowrite aa is injected automatically based on the type

Spring injection method 1 setter 2 constructor 3 enforce assignment

The order of instantiation b a C depends on all objects in the chain, initialized in the IOC container

Class C{private A A;

public void fun(){ a.xxx(); }}

Class A{

Private B B;

}

Section-oriented AOP takes the whole thing, breaks it down, develops it separately, and then puts it back together at release time. The rule of the split is the section, according to the section in seamless assembly. The core idea is decoupling

AOP is fully integrated into Spring

Transction Manager Transaction Lazy Loading context Process Error Handler Error tracing (exception catching mechanism) Cache cache

Di dependency injection IOC Inversion of control AOP Aspect Oriented Spring core tenet: Simplify development AOP core tenet: decouple

Using proxy mode CGLib dynamic proxy AOP: Transaction proxy (declarative transaction, which method needs to add transaction, which method does not need to add transaction) log listener Service method open transaction execution is done by our own code You may need to decide whether to rollback the transaction or continue to commit based on the exception type. Commit rollback the transaction must be closed

Spring thought application scenario induces AOP to find a number of classes have a certain rule of code, development time to dismantle, run time merge. Section-oriented programming, that is, rule-oriented programming decoupling, dedicated person to do specialized OOP to summarize all the things in life. Object-oriented programming. Encapsulation, inheritance, polymorphism IOC gives rights to new objects to Spring transactions, and it is up to Spring to save created objects for inversion of control DI/DL dependency injection, dependency lookup. Spring stores not only the objects it creates but also the relationships between objects. Injection is assignment, there are three main ways: constructor, set, direct assignment first sort out the relationship and then assign BOP Bean-oriented designer everything starts with beans

Spring has about 20 modules in total, made up of more than 1,300 different files. These components are integrated into Core Container, AOP (Aspect Oriented Programming) and Instrmentation, Data Access and Integeration, respectively. Web, Message sending (Message), Test, 6 modules set. Here is an architecture diagram for Spring4

Spring relies on the structure diagram

Spring Source Roadmap: Start with Spring-Core, then spring-Beans and spring-AOP, then spring-Contest, then Spring-TX and spring-ORM, finally Spring-Web and other sections

Download the source code: Step 1 github.com/spring-proj…

The second step is to download gradle downloads.gradle.org/distributio…

Step 3 Unpack and configure GRADLE_HOME and Path

Step 4 Verify that gradle -V environment variables are correct

Gradle Eclipse-x: Eclipse takes a while to build