引言
- 因为每种方式下面都包含几种具体的方式,博客量较大,因此每种都分为单独博客
- 这里仅作为总结
- 具体某一种有链接博客
手动装配
- 构造方法注入
- 属性 setter 方法注入
- p 命名空间注入
- 博客:https://blog.csdn.net/qq_36654606/article/details/87179627
SpEL 表达式
- < property name="" value="#{表达式}">
- #{123}、#{‘jack’} : 数字、字符串
- #{beanId} :另一个bean引用
- #{beanId.propName} :操作数据
- #{beanId.toString()} :执行方法
- #{T(类).字段|方法} :静态方法或字段
- 博客:https://blog.csdn.net/qq_36654606/article/details/87179627
集合注入
- 集合的注入都是给添加子标签
1. 数组:< array>
2. List:< list>
3. Set:< set>
4. Map:< map> ,map存放k/v 键值对,使用描述
5. Properties:< props> 【】
6. 普通数据:< value>
7. 引用数据:< ref> - 博客:https://blog.csdn.net/qq_36654606/article/details/87180078