导入Spring的核心包和一个依赖包
创建Spring的配置文件applicationContext.xml
并且添加schame约束
使用<bean>标签 的id 和 class 属性添加 Dao 和Service 的Impl
在Service下使用<property>属性 的 name(需和serviceImpl类的daoimpl属性名字相同) 和 ref 引用 Dao的id
使用
ApplicationContext(接口) a = new ClassPathXMLApplicationContext(“classpath路径”);
Service service = (Service)a.getBean(“serviceBean的id”);
Ioc
控制反转,就是把类的实例化交给Spring管理
DI
依赖注入,就是一个类的私有属性有另一个类,并且通过set方法实例化