Spring实战Day3
通过XML创建装配bean
1.装配不存在成员变量的bean
<bean id="talent" class="cn.jqzhong.Spring.study.day2.LiteraryTalent"></bean>
2.装配存在成员变量的bean
2.1通过构造器注入
2.1.1属性值为引用类型、引用类型列表
<bean id="people" class="cn.jqzhong.Spring.study.day2.LikeMePeople">
<constructor-arg ref="talent"></constructor-arg><constructor-arg>
<list>
<ref bean=""></ref>
<ref bean=""></ref>
</list>
</constructor-arg>
</bean>
2.1.2属性值为字面值、字面值类型列表
<bean id="people" class="cn.jqzhong.Spring.study.day2.LikeMePeople">
<constructor-arg value="xxx"></constructor-arg>
<constructor-arg>
<list>
<value>xxx</value>
<value>xxx</value>
</list>
</constructor-arg>
</bean>
2.2通过属性设置
2.2.1属性值为引用类型、引用类型列表
<bean id="people" class="cn.jqzhong.Spring.study.day2.LikeMePeople">
<property name="talent" ref="talent"></property>
<property>
<list>
<ref bean=""></ref>
<ref bean=""></ref>
</list>
</property>
</bean>
2.2.2属性值为属性值为字面值、字面值类型列表
<bean id="people" class="cn.jqzhong.Spring.study.day2.LikeMePeople">
<property name="talent" value="xxx"></property>
<property name="otherTlent">
<list>
<value>xxx</value>
<value>xxx</value>
</list>
</property>
</bean>
最新文章
- 【poj2096】Collecting Bugs
- Python 正则表达式:只要整数和小数
- Json.net对于导航属性的处理(解决对象循环引用)
- [SQL]一组数据中Name列相同值的最大Je与最小je的差
- Pandas系列教程——写在前面
- mysql并发复制系列 一:binlog组提交
- 构建本地yum源之rpmbuild问题汇总
- mac下的改装人生——关于ssd
- oracle 异常管理
- linux下的DNS
- Kali Rolling在虚拟机安装后的设置
- 前端基本知识(四):JS的异步模式:1、回调函数;2、事件监听;3、观察者模式;4、promise对象
- 一步一步从原理跟我学邮件收取及发送 12.telnet命令行收一封信pop3
- mysql 执行sql流程
- CentOS6.5 安装vncserver实现图形化访问
- HDU4460
- bzoj4985 评分 (二分答案+dp)
- Gym - 100851F - Froggy Ford(dijkstra)
- hadoop发行版本之间的区别
- openstack cpu pinning