What is Spring method injection:
In fact, the method in the entity class is given to spring management (implementation);
Example:
Package party.infoo.entity; /** */publicabstractclass mans {private Dog Dog; It is also possible not to write abstract, the effect is the same as public abstract Dog getdog (); Public void Setdog (dog dog) { this. Dog = dog; }}
<BeanID= "Man1"class= "Party.infoo.entity.Man"> <Lookup-methodname= "Getdog"Bean= "Dog" ></Lookup-method> </Bean> <BeanID= "Man2"class= "Party.infoo.entity.Man"> <Lookup-methodname= "Getdog"Bean= "Dog" ></Lookup-method> </Bean> <BeanID= "Dog"class= "Party.infoo.entity.Dog"Scope= "Prototype"> < Propertyname= "Name"value= "Dod_aa"/> < Propertyname= "Age"value= "5"/> </Bean>
The effect is that every dog is different, even the same person, the first time Getdog () and the second Getdog () are not the same
Spring Method Injection