This article mainly introduces the process analysis of spring IOC injection mode, the article introduces in detail through the example code, which has certain reference learning value for everyone’s study or work, and friends in need can refer to it
There are two main methods for spring IOC injection
1: Set value injection
2: Structural injection
In short, one is to call the set method to set the value, and the other is to set the value through the constructor
<?xml version= "1.0" encoding= "UTF-8"?> <beans xmlns= "http://www.springframework.org/schema/beans" xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation= "http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd" default-init-method= "init" default-destroy-method= "destroy"> <!-- <bean> <property name="injectionDAO" ref="InjectionDAO"></property> </bean> --> <bean> <constructor-arg name="injectionDAO" ref="InjectionDAO"></constructor-arg> </bean> <bean class= "Main.InjectionDAOImpl"> </bean> </beans>
The above is the whole content of this article, I hope to help you in your study, and I hope you can support developeppaer more.