1. 基于set方法注入
<bean class="com.jixian.spring.entity.Book"> <property name="bname" value="计算机百科全书"/> <property name="author" value="jixian"/> </bean>
2. 基于构造器注入
<bean class="com.jixian.spring.entity.Book"> <constructor-arg name="bname" value="计算机网络"/> <constructor-arg name="author" value="jixian"/> </bean>
标签:基于,依赖,Spring,构造,set,注入 From: https://www.cnblogs.com/jixian/p/17156249.html