Spring Technology (ii) ----- IOC
Spring technology-IOC is also called dependency injection (DI)
(1) setter-based injection
(2) constructor-based injection
(3) Bean references
1. Create a Java Project. The name is springtest2. Create a package. The name is com. gxcme. springtest2.
2. Add the spring framework.
3. Create an Interface. The name is helloInterface. java.
<喎?http: www.bkjia.com kf ware vc " target="_blank" class="keylink"> VcD4KPHA + NC7Qwr2o0ru49mNsYXNzoaPD + ratio = "http://www.2cto.com/uploadfile/Collfiles/20140907/20140907092202246.png" alt = "\">
5. configure it in the applicationContext. xml file.
6. Create a new class. The name is helloMain. java. Then run
7. References between beans
Create an Interface. The name is personInterface. java.
Create a new class. The name is personImpl. java. Inherits the personInterface.
In the applicationContext. xml file.
Create a new class. The name is personMain. java. Then run