HelloSpring
ApplicationContext context=new ClassPathXmlApplicationContext("beans.xml");
//直接取出
Hello hello=(Hello) context.getbean("hello");
hello.toString().sout();
bean等于对象
id 等价于 变量名
class new 的对象
property相当于给对象属性设置一个值。
对象由Spring创建,管理,装配。
<bean id="UserServiceImpl" class="com.kuang.service.UserServiceImpl">
<property name="userDao" ref="mysqlImpl"/>
</bean>
ref:引用Spring容器中创建好的对象
value:具体的值,基本数据类型
通过配置文件修改,灵活。