Spring源码学习--ConfigurableApplicationContext(十)
ApplicationContext体系:ConfigurableApplicationContext接口中定义了一些基本操作,比如设置上下文ID,设置父应用上下文,添加监听器和刷新容器相关的操作等。源码如下:public interface ConfigurableApplicationContext extends ApplicationContext, Lifecycle, Closeabl
·
ApplicationContext体系:
ConfigurableApplicationContext接口中定义了一些基本操作,比如设置上下文ID,设置父应用上下文,添加监听器和刷新容器相关的操作等。
源码如下:
public interface ConfigurableApplicationContext extends ApplicationContext, Lifecycle, Closeable {
String CONFIG_LOCATION_DELIMITERS = ",; \t\n";
String CONVERSION_SERVICE_BEAN_NAME = "conversionService";
String LOAD_TIME_WEAVER_BEAN_NAME = "loadTimeWeaver";
String ENVIRONMENT_BEAN_NAME = "environment";
String SYSTEM_PROPERTIES_BEAN_NAME = "systemProperties";
String SYSTEM_ENVIRONMENT_BEAN_NAME = "systemEnvironment";
//设置上下文ID
void setId(String id);
//设置父ApplicationContext
void setParent(ApplicationContext parent);
@Override
ConfigurableEnvironment getEnvironment();
void setEnvironment(ConfigurableEnvironment environment);
void addBeanFactoryPostProcessor(BeanFactoryPostProcessor beanFactoryPostProcessor);
//添加监听器
void addApplicationListener(ApplicationListener<?> listener);
//在子类中实现创建容器
void refresh() throws BeansException, IllegalStateException;
void registerShutdownHook();
@Override
void close();
boolean isActive();
//获取Bean工厂
ConfigurableListableBeanFactory getBeanFactory() throws IllegalStateException;
}
更多推荐
已为社区贡献9条内容
所有评论(0)