IOC控制反转
控制反转(inversion of control)把创建对象的权力交给框架,是框架的重要特征,并非面向对象编程的专用术语,他包括依赖注入(Dependency Injection ,DI)和依赖查找(Dependency Lookup ,DL)
- 作用:
- 削减计算机程序的耦合(解除代码中的依赖关系)
导入xml约束
google已经收藏该页面,搜索xml找到约束
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean id="..." class="...">
<!-- collaborators and configuration for this bean go here -->
</bean>
<bean id="..." class="...">
<!-- collaborator