在xml 文件中通过bean 节点来配置bean
<bean id="helloword" class="cn.nokia.pojo.Helloword">
<property name="name" value="erhuan">
</property>
</bean>
注
- id 为Bean的名称
- id在容器中是唯一的
- id没有指定那么会使用bean的名字
id 可以指定多个使用 逗号 分号 空格分隔
Dog dog = (Dog) ctx.getBean(“cn.nokia.pojo.Dog”);