ClassPathXmlApplicationContext类

org.springframework.context.support 
Class ClassPathXmlApplicationContext

java.lang.ObjectClassPathXmlApplicationContext类org.springframework.core.io.DefaultResourceLoaderClassPathXmlApplicationContext类org.springframework.context.support.AbstractApplicationContextClassPathXmlApplicationContext类org.springframework.context.support.AbstractRefreshableApplicationContextClassPathXmlApplicationContext类org.springframework.context.support.AbstractRefreshableConfigApplicationContextClassPathXmlApplicationContext类org.springframework.context.support.AbstractXmlApplicationContextClassPathXmlApplicationContext类org.springframework.context.support.ClassPathXmlApplicationContext
All Implemented Interfaces:
BeanFactoryBeanNameAwareDisposableBeanHierarchicalBeanFactoryInitializingBeanListableBeanFactoryApplicationContextApplicationEventPublisher,ConfigurableApplicationContextLifecycleMessageSourceResourceLoaderResourcePatternResolver

public class ClassPathXmlApplicationContext
extends AbstractXmlApplicationContext

该类继承了AbstractXmlApplicationContext,实现了BeanFctory和ApplicationContext接口。

使用BeanFactory接口还是ApplicationContext接口?

BeanFactory只是实现了Spring基本的功能,而ApplicationContext添加了更多的功能,并且ApplicationContext完全支持BeanFactory的所有功能,ApplicationContext建立于BeanFactory基础之上的。ApplicationContext是BeanFactory的子接口,而BeanFactory是ApplicationContext的父接口。所以,建议优先使用ApplicationContext接口。

官方文档解释:

In short, the BeanFactory provides the configuration framework and basic functionality, and the ApplicationContext adds more enterprise-specific functionality. The ApplicationContext is a complete superset of the BeanFactory

上一篇:详解如何实现斗鱼、B站等全局悬浮窗直播小窗口


下一篇:jQuery知识点总结(第二天)