依赖注入的方式
1. 通过bean的setXxx()方法赋值
Hello World中使用的就是这种方式

2. 通过bean的构造器赋值
- Spring自动匹配合适的构造器
| <bean id=“book” class=“com.atguigu.spring.bean.Book” > <constructor-arg value= “10010”/> <constructor-arg value= “Book01”/> <constructor-arg value= “Author01”/> <constructor-arg value= “20.2”/> </bean > |
- 通过索引值指定参数位置
| <bean id=“book” class=“com.atguigu.spring.bean.Book” > <constructor-arg value= “10010” index =“0”/> <constructor-arg value= “Book01” index =“1”/> <constructor-arg value= “Author01” index =“2”/> <constructor-arg value= “20.2” index =“3”/> </bean > |



![[附源码]Python计算机毕业设计大学生志愿者管理系统](https://img-blog.csdnimg.cn/d060c19b9eba49e3980bd671ac6742b5.png)















