别名就是可以通过另外一个名字来访问如下,已有bean:helloWorld3,那么定义别名(alias )后,就能使用“abc”来访问
<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