Spring 一二事(3) - 别名
2016-03-22 10:54
519 查看
别名就是可以通过另外一个名字来访问如下,已有bean:helloWorld3,那么定义别名(alias )后,就能使用“abc”来访问
github地址:https://github.com/leechenxiang/maven-spring001-helloworld
<bean id="helloWorld3" factory-bean="helloWorldFactory" factory-method="getInstance"></bean> <!-- 别名 name 属性值要和 id 一致 --> <alias name="helloWorld3" alias="abc" /> <alias name="helloWorld3" alias="测试" />
HelloWorld hello = (HelloWorld)context.getBean("abc");
github地址:https://github.com/leechenxiang/maven-spring001-helloworld
相关文章推荐
- eclipse从数据库获取数据时控制台乱码问题
- Java多线程异步调度程序分析(二)
- Spring 一二事(2)
- eclipse启动无响应,停留在Loading状态
- java基础 - 位运算符
- Leetcode: 165. Compare Version Numbers(JAVA)
- 对Java多态性的理解
- Struts 有哪些经常使用标签库
- wget 官方jdk
- Spring Security(06)——AuthenticationProvider
- Spring MVC 流程图
- eclipse 安装svn插件
- java基础第四天_复习运算符、进制转化和数组
- 给Java说句公道话
- Spring的AOP使用xml配置
- Eclipse 中的重构功能
- Java的字节流和字符流
- JavaScrit常用的简单交互
- Java数组取交集
- Java内存区域