BeanFactory 才是Spring 容器中的顶层接口。
ApplicationContext 是它的子接口。

ApplicationContext

它在构建核心容器时, 创建对象采取的策略是采用立即加载的方式。

也就是说,只要一读取完配置文件, 马上就创建配置文件中配置的对象。

单例对象适用

BeanFactory

它在构建核心容器时,创建对象采取的策略是采用延迟加载的方式。

也就是说, 什么时候根据ID获取对象,什么时候才真正的创建对象。

多例对象适用

核心容器的两个接口(ApplicationContext和BeanFactory)引发出的问题的更多相关文章

  1. 获取spring的IOC核心容器,并根据id获取对象

    public class Client { /** * 获取spring的IOC核心容器,并根据id获取对象 * ApplicationContext的三个常用实现类 * classPathXmlAp ...

  2. Spring(二)核心容器 - 简介 、BeanFactory、ApplicationContext

    目录 前言 1.容器简介 2.容器的结构 2.1 BeanFactory 2.2 ApplicationContext 2.2.1 ConfigurableApplicationContext 2.2 ...

  3. Spring(三)核心容器 - ApplicationContext 上下文启动准备

    目录 前言 正文 第一步:prepareRefresh 第二步:obtainFreshBeanFactory 第三步:prepareBeanFactory 第四步:postProcessBeanFac ...

  4. 面试题:ApplicationContext和BeanFactory两种容器区别

    ApplicationContext和BeanFactory两种容器区别 BeanFactory是ApplicationContext容器的父接口 BeanFactory(多例模式): BeanFac ...

  5. spring的核心容器ApplicationContext

    //bean.xml配置文件 <?xml version="1.0" encoding="UTF-8"?><beans xmlns=" ...

  6. Asp.net 面向接口可扩展框架之核心容器(含测试代码下载)

    新框架的容器部分终于调通了!容器实在太重要了,所以有用了一个名词叫“核心容器”. 容器为什么那么重要呢?这个有必要好好说道说道. 1.首先我们从框架名称面向接口编程说起,什么是面向接口编程?(这个度娘 ...

  7. 创建ApplicationContext与BeanFactory时的区别-Spring源码学习之容器的基本实现

    传送门 可以加载XML两种方法 使用 BeanFactory 加载 XML BeanFactory bf = new XmlBeanFactory(new ClassPathResource(&quo ...

  8. Spring(五)核心容器 - 注册 Bean、BeanDefinitionRegistry 简介

    目录 前言 正文 1.BeanDefinitionRegistry 简介 2.registerBeanDefinition 方法注册 Bean 最后 前言 上篇文章我们对 BeanDefinition ...

  9. Spring的核心api和两种实例化方式

    一.spring的核心api Spring有如下的核心api BeanFactory :这是一个工厂,用于生成任意bean.采取延迟加载,第一次getBean时才会初始化Bean Applicatio ...

随机推荐

  1. Codeforces Round #243 (Div. 1)——Sereja and Two Sequences

    版权声明:本文为博主原创文章,未经博主同意不得转载. https://blog.csdn.net/u012476429/article/details/24798219 题目链接 题意:给两个长度分别 ...

  2. 小米系列手机调试Installation failed with message Failed to establish session

    用Android studio 2.3调度程序时提示"Installation failed with message Failed to establish session"错误 ...

  3. EASYARM-IMX283 制作ubifs文件系统

    ubifs主页:http://www.linux-mtd.infradead.org/doc/ubifs.html nandflash上常用的文件系统有jffs2.yaffs和ubifs,其中ubif ...

  4. hadoop —— MapReduce例子 (数据排序)

    参考:http://eric-gcm.iteye.com/blog/1807468 file1.txt: 2 32 654 32 15 756 65223 file2.txt: 5956 22 650 ...

  5. Hadoop- MapReduce在实际应用中常见的调优

    1.Reduce Task Number 通常来说一个block就对应一个map任务进行处理,reduce任务如果人工不去设置干预的话就一个reduce.reduce任务的个数可以通过在程序中设置   ...

  6. HDU 4652 Dice:期望dp(成环)【错位相减】

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4652 题意: 给你一个有m个面的骰子. 两种询问: (1)"0 m n": “最后 ...

  7. Smack编程库进行代码功能调试

    http://www.tuicool.com/articles/U3Afiy 使用Smack编程库进行代码功能调试 关于Smack编程库,前面我们提到,它是面向Java端的api,主要在PC上使用,利 ...

  8. codeforces 705B B. Spider Man(组合游戏)

    题目链接: B. Spider Man time limit per test 2 seconds memory limit per test 256 megabytes input standard ...

  9. PS 滤镜— — 镜头光晕

    clc; clear all; close all; addpath('E:\PhotoShop Algortihm\Image Processing\PS Algorithm'); I=imread ...

  10. Stop logging "internal dummy connection" in Apache

    Apache 2.x keeps child processes alive by creating internal connections which appear in the log file ...