6.Spring学习笔记_Bean之间的关系 (by尚硅谷_佟刚)
来源:互联网 发布:用手机淘宝怎么买彩票 编辑:程序博客网 时间:2024/04/29 05:30
一、继承 Bean 配置
Spring 允许继承 bean 的配置, 被继承的 bean 称为父 bean. 继承这个父 Bean 的 Bean 称为子 Bean
子 Bean 从父 Bean 中继承配置, 包括 Bean 的属性配置
子 Bean 也可以覆盖从父 Bean 继承过来的配置
父 Bean 可以作为配置模板, 也可以作为 Bean 实例. 若只想把父 Bean 作为模板, 可以设置 <bean> 的abstract 属性为 true, 这样 Spring 将不会实例化这个 Bean
并不是 <bean> 元素里的所有属性都会被继承. 比如: autowire, abstract 等.
也可以忽略父 Bean 的 class 属性, 让子 Bean 指定自己的类, 而共享相同的属性配置. 但此时 abstract 必须设为 true
二、依赖 Bean 配置
Spring 允许用户通过 depends-on 属性设定 Bean 前置依赖的Bean,前置依赖的 Bean 会在本 Bean 实例化之前创建好
如果前置依赖于多个 Bean,则可以通过逗号,空格或的方式配置 Bean 的名称
0 0
- 6.Spring学习笔记_Bean之间的关系 (by尚硅谷_佟刚)
- 7.Spring学习笔记_Bean的作用域(by尚硅谷_佟刚)
- 10.Spring学习笔记_管理Bean的生命周期(by尚硅谷_佟刚)
- 18.Spring学习笔记_切面的优先级(by尚硅谷_佟刚)
- 3.Spring学习笔记_配置Bean(by尚硅谷_佟刚)
- 4.Spring学习笔记_属性配置细节(by尚硅谷_佟刚)
- 5.Spring学习笔记_自动装配(by尚硅谷_佟刚)
- 8.Spring学习笔记_使用外部属性文件(by尚硅谷_佟刚)
- 12.Spring学习笔记_通过FactoryBean配置Bean(by尚硅谷_佟刚)
- 13.Spring学习笔记_通过注解配置Bean(by尚硅谷_佟刚)
- 14.Spring学习笔记_泛型依赖注入(by尚硅谷_佟刚)
- 16.Spring学习笔记_前置通知&后置通知(by尚硅谷_佟刚)
- 19.Spring学习笔记_重用切点表达式(by尚硅谷_佟刚)
- 20.Spring学习笔记_基于配置文件的方式来配置 AOP(by尚硅谷_佟刚)
- 1.Spring学习笔记_HelloWorld(by尚硅谷_佟刚)
- 2.Spring学习笔记_IOC&DI概述(by尚硅谷_佟刚)
- 9.Spring学习笔记_SpEL(by尚硅谷_佟刚)
- 15.Spring学习笔记_AOP基础(by尚硅谷_佟刚)
- Visual Studio助手Visual Assist各版本破解安装
- mysql启动问题access denied for user 'root'@'localhost'(using password:YES)
- 大数据学习路线
- pl/sql 美化规则
- node.js学习(一)
- 6.Spring学习笔记_Bean之间的关系 (by尚硅谷_佟刚)
- 使用Jrebel 实现 maven+wildfly10 热部署
- 《算法》第二章——生成快排的最佳序列
- Python的heapq模块实现大顶堆,小顶堆
- [NOIP2016]换教室
- Web基础和错误
- Cocopods 更新后遇到 这样的问题 The dependency xxxxxxxx is not used in any concrete target
- 【C#】关于服务Service的操作(是否存在,是否启动,是否自动启动)
- 【2】Struts2的常见配置