Spring dependency injection three ways

set injection
dependency injection by reflecting the underlying implementation
details of the problem:
. A

This statement is equal

liuhao

b.
If the input <should not be recognized in the content: <entity references can own Baidu know more.
If a child element: <! [CDATA [enter here things]]>
. C
processing value ""



D.
Processing null values:


2. The method of construction assignment
if the constructor uprising comparison, then with the type or name to distinguish
the code of xml:
<- assignment by the constructor!


Codes eneity of:
public Teacher () {
}
public Teacher (String name, int Age) {
Super ();
this.name = name;
this.age = Age;
}
Note:
a if not <method parameters and the order of the structure constructor-arg, by the need to modify the index name type.
B must. the no-argument constructor also add to, otherwise it will error.

3.p Namespace injection:
in most head plus
xmlns: P = " http://www.springframework.org/schema/p "
sequence does not matter,

Guess you like

Origin blog.csdn.net/guoguozgw/article/details/91344842