Spring 的构成结构
DAO:JDBC、Transaction、management
ORM:Hibernate、JPA、TopLink、JDO、OJB、Ibatis
AOP:Asject、cglib、java代理
Web:JSP、Velocity、Freemarker
1,Spring 简介:
类型:BeanFactory、ApplicationContext
其中ApplicationContext继承了BeanFactory ,而且比BeanFactory功能更加强大
主要利用的三种ApplicationContext类:
1.FileSystemXmlApplicationContext("")
2.ClassPathXmlApplicationContext("")
3.WebApplicationContext("")
2.Bean组件容器的实例化:
1、构造器的实现;
2、静态工厂方法;
3、动态工厂方法;
例子:
1. <bean name/id = "" class = ""/>
2.静态工厂方法:
<bean class = "" factory-method = ""/>
方法必须为:static 静态
<bean factory-bean = "" factory-method=""/>
3.bean的别名定义:
<alias name = "fromBeanName" alias = "newBeanName"/>
bean对象的模式默认为:singleton 回调:init-method、destroy-method
attribute:default-init-method:
attribute:default-destroy-method:
4.Bean延迟实例化属性配置:lazy-init = “true”
5.依赖关系:
<depends-on = "" /> 依赖的bean方法
6.setter方法:
<properties name= "属性"/>
7.构造器:
<constructor-arg index/name = "" value = "">