Spring 进阶一

以前创建对象都是通过new的方式

Spring提出新的方案
Ioc底层的原理和使用技术
一:xml配置
二:Dom4j解析xml
三:工程的设计模式
四:反射

Ioc入门案例
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:context="http://www.springframework.org/schema/context" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:task="http://www.springframework.org/schema/task" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsd http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-4.0.xsd
</beans>
|
|
|
|
通过配置文件创建对象

class为创建对象类的全路径

xml文件提示

对象创建的三种方式

第二种

第三种

Factory-method 为方法名
09-bean标签常用属性(id、class和name)


11-属性注入介绍

Spring框架只支持前面两种方式
构造方式 

打印结果

Set注入


set注入对象

15-注入复杂类型属性
P命名空间注入 还有很多比较复杂的注入 如 数组 list map。。。

Ioc和dI的区别
