Spring in Action Study Note 2-DI, spring-di
Assemble bean
October 9, 2015
9: 49
In Sprng, objects do not need to be searched for or created by themselves. Related: the container is responsible for assigning objects to each object by referencing the objects that need to cooperate with each other.
The act of creating a cooperative relationship between application objects is generally called an assembly ). This is the essence of dependency injection.
Declare bean
Typical xml configuration file
Capture Time of on-screen editing:
Spring core comes with 10 command Spaces
Screen clip capture time:
Capture Time of on-screen editing:
Screen clip capture time:
Constructor injection:
Screen clip capture time:
Screen clip capture time:
Capture Time of on-screen editing:
Capture Time of on-screen editing:
Capture Time of on-screen editing:
Capture Time of on-screen editing:
Capture Time of on-screen editing:
Initialization and destruction
Screen clip capture time:
Screen clip capture time:
Capture Time of on-screen editing:
Capture Time of on-screen editing:
Capture Time of on-screen editing:
Injection attributes
1. Inject simple values:
Capture Time of on-screen editing:
Capture Time of on-screen editing:
Capture Time of on-screen editing:
2. Introduce other beans
Screen clip capture time:
Introduce internal bean
Capture Time of on-screen editing:
Capture Time of on-screen editing:
Capture Time of on-screen editing:
Command Space p Assembly attributes
Capture Time of on-screen editing:
Capture Time of on-screen editing:
Capture Time of on-screen editing:
3. Assembly set
Capture Time of on-screen editing:
Screen clip capture time:
Screen clip capture time:
Screen clip capture time:
Capture Time of on-screen editing:
Capture Time of on-screen editing:
Capture Time of on-screen editing:
Capture Time of on-screen editing:
Maap
Capture Time of on-screen editing:
Capture Time of on-screen editing:
Capture Time of on-screen editing:
Capture Time of on-screen editing:
Capture Time of on-screen editing:
Null Value:
Capture Time of on-screen editing:
Assemble with expressions (omitted ).
Minimal xml configuration
October 9, 2015
11: 10
4. Automatic Assembly of types (omitted)
Capture Time of on-screen editing:
3.2 annotation assembly:
Capture Time of on-screen editing:
Capture Time of on-screen editing:
Capture Time of on-screen editing:
Capture Time of on-screen editing:
Capture Time of on-screen editing:
Capture Time of on-screen editing: