spring4.x(四)之第三章--BeanFactory与ApplicationContext

1. BeanFactory

  1. BeanFactory 体系结构
    这里写图片描述
    部分类详解:
    这里写图片描述
    这里写图片描述

  2. 初始化 BeanFactory
    使用 Spring 配置文件为 Car 类提供配置信息,然后通过 BeanFactory 装载配置文件,启动 spring IoC 容器:
    这里写图片描述
    这里写图片描述
    这里写图片描述

2. ApplicationContext

  1. ApplicationContext 类体系结构
    这里写图片描述
    这里写图片描述
    这里写图片描述
    两个实现类:
    ①. ClassPathXmlApplicationContext:默认从类路径加载配置文件
    ②. FileSystemXmlApplicationContext:默认从文件系统中装载配置文件
  2. WebApplicationContext
    spring 提供的用语启动 WebApplicationContext 的 Servlet 和 Web 容器监听器:
    ①. org.springframework.web.context.ContextLoaderServlet
    ②. org.springframework.web.context.ContextLoaderListenser
    通过 web 容器监听器引导:
    这里写图片描述
    这里写图片描述
    通过自启动的 servlet 引导(不支持容器监听器的低版本 web 容器):
    这里写图片描述
    指定 log4j 配置文件时,启动 spring web 应用上下文:
    这里写图片描述

推荐阅读:Spring揭秘 学习笔记一 (Spring的IoC容器 一)

猜你喜欢

转载自blog.csdn.net/yin__ren/article/details/80915877