IoC基础实例
1.创建工程
2.导入jar包(6个)
3.制作核心配置文件applicationContext.xml
位置:src目录下
参看文档中的内容制作
//Spring格式(ClassPathXmlApplicationContext)
//1.将资源交给Spring管理,以Bean的形式进行配置
//2.使用ApplicationContext对象获取Bean
//2.1获取ApplicationContext对象
ApplicationContext ctx = new ClassPathXmlApplicationContext("applicationContext.xml");
//2.2获取Bean
BeanOne one = (BeanOne) ctx.getBean("beanOne");
//2.3运行
one.testFn();