Spring Boot for VMware GemFire
Class RefreshableAnnotationConfigApplicationContext
java.lang.Object
org.springframework.core.io.DefaultResourceLoader
org.springframework.context.support.AbstractApplicationContext
org.springframework.context.support.AbstractRefreshableApplicationContext
org.springframework.context.support.AbstractRefreshableConfigApplicationContext
org.springframework.geode.context.annotation.RefreshableAnnotationConfigApplicationContext
- All Implemented Interfaces:
Closeable,AutoCloseable,org.springframework.beans.factory.Aware,org.springframework.beans.factory.BeanFactory,org.springframework.beans.factory.BeanNameAware,org.springframework.beans.factory.HierarchicalBeanFactory,org.springframework.beans.factory.InitializingBean,org.springframework.beans.factory.ListableBeanFactory,org.springframework.context.annotation.AnnotationConfigRegistry,org.springframework.context.ApplicationContext,org.springframework.context.ApplicationEventPublisher,org.springframework.context.ConfigurableApplicationContext,org.springframework.context.Lifecycle,org.springframework.context.MessageSource,org.springframework.core.env.EnvironmentCapable,org.springframework.core.io.ResourceLoader,org.springframework.core.io.support.ResourcePatternResolver
public class RefreshableAnnotationConfigApplicationContext
extends org.springframework.context.support.AbstractRefreshableConfigApplicationContext
implements org.springframework.context.annotation.AnnotationConfigRegistry
A refreshable
ApplicationContext capable of loading component classes used for
Annotation based configuration in addition to scanning configuration locations, and then
providing the ability to reload/refresh the context at some point later during runtime.
DISCLAIMER: Currently, this ApplicationContext implementation (and extension) is being used exclusively for
testing and experimental (R&D) purposes. It was designed around Apache Geode's forced-disconnect
/ auto-reconnect functionality, providing support for this behavior inside a Spring context. Specifically, this
concern is only applicable when using Spring Boot to configure and bootstrap Apache Geode peer member
Cache applications, such as when annotating your Spring Boot application with
SDG's PeerCacheApplication annotation. This ApplicationContext implementation is not recommended for
use in Production Systems/Applications (yet).- Since:
- 1.3.0
- See Also:
-
BeanDefinitionBeanDefinitionRegistryBeanNameGeneratorDefaultListableBeanFactoryApplicationContextAnnotatedBeanDefinitionReaderAnnotationConfigRegistryClassPathBeanDefinitionScannerScopeMetadataResolverAbstractRefreshableConfigApplicationContext
-
Nested Class Summary
Nested classes/interfaces inherited from class org.springframework.core.io.DefaultResourceLoader
org.springframework.core.io.DefaultResourceLoader.ClassPathContextResource -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final booleanprotected static final booleanFields inherited from class org.springframework.context.support.AbstractApplicationContext
APPLICATION_EVENT_MULTICASTER_BEAN_NAME, LIFECYCLE_PROCESSOR_BEAN_NAME, MESSAGE_SOURCE_BEAN_NAMEFields inherited from interface org.springframework.beans.factory.BeanFactory
FACTORY_BEAN_PREFIXFields inherited from interface org.springframework.context.ConfigurableApplicationContext
APPLICATION_STARTUP_BEAN_NAME, CONFIG_LOCATION_DELIMITERS, CONVERSION_SERVICE_BEAN_NAME, ENVIRONMENT_BEAN_NAME, LOAD_TIME_WEAVER_BEAN_NAME, SHUTDOWN_HOOK_THREAD_NAME, SYSTEM_ENVIRONMENT_BEAN_NAME, SYSTEM_PROPERTIES_BEAN_NAMEFields inherited from interface org.springframework.core.io.ResourceLoader
CLASSPATH_URL_PREFIXFields inherited from interface org.springframework.core.io.support.ResourcePatternResolver
CLASSPATH_ALL_URL_PREFIX -
Constructor Summary
ConstructorsConstructorDescriptionConstructs an new instance of theRefreshableAnnotationConfigApplicationContextwith default container state and no parentApplicationContext.RefreshableAnnotationConfigApplicationContext(org.springframework.context.ApplicationContext parent) Constructs a new instance of theRefreshableAnnotationConfigApplicationContextinitialized with the parentApplicationContext. -
Method Summary
Modifier and TypeMethodDescriptionprotected Optional<org.springframework.beans.factory.support.BeanNameGenerator>Returns theoptionallyconfiguredBeanNameGeneratorstrategy used by thisApplicationContextto generatebean namesforbean definitions.protected org.slf4j.LoggerReturns the configuredLoggerused to log framework messages to the application log.Optional<org.springframework.context.annotation.ScopeMetadataResolver>Returns theoptionallyconfiguredScopeMetadataResolverstrategy used by thisApplicationContextto resolve the scope forbean definitions.protected booleanprotected booleanprotected voidloadBeanDefinitions(org.springframework.beans.factory.support.DefaultListableBeanFactory beanFactory) LoadsBeanDefinitionsfrom Annotation configuration (component) classes as well as from other resource locations (e.g.protected org.springframework.context.annotation.AnnotatedBeanDefinitionReadernewAnnotatedBeanDefinitionReader(org.springframework.beans.factory.support.BeanDefinitionRegistry registry) protected org.springframework.context.annotation.ClassPathBeanDefinitionScannernewClassBeanDefinitionScanner(org.springframework.beans.factory.support.BeanDefinitionRegistry registry) protected voidRe-registers Singleton beans registered with the previousBeanFactory(prior to refresh) with thisApplicationContext, iff this context was previously active and subsequently refreshed.protected voidStores a reference to the previousConfigurableListableBeanFactoryin order to copy its configuration and state onApplicationContextrefresh invocations.voidvoidvoidsetBeanNameGenerator(org.springframework.beans.factory.support.BeanNameGenerator beanNameGenerator) Configures theBeanNameGeneratorstrategy used by thisApplicationContextto generatebean namesforbean definitions.voidsetScopeMetadataResolver(org.springframework.context.annotation.ScopeMetadataResolver scopeMetadataResolver) Configures theScopeMetadataResolverstrategy used by thisApplicationContextto resolve the scope forbean definitions.Methods inherited from class org.springframework.context.support.AbstractRefreshableConfigApplicationContext
afterPropertiesSet, getConfigLocations, getDefaultConfigLocations, resolvePath, setBeanName, setConfigLocation, setConfigLocations, setIdMethods inherited from class org.springframework.context.support.AbstractRefreshableApplicationContext
assertBeanFactoryActive, cancelRefresh, closeBeanFactory, createBeanFactory, customizeBeanFactory, getBeanFactory, hasBeanFactory, refreshBeanFactory, setAllowBeanDefinitionOverriding, setAllowCircularReferencesMethods inherited from class org.springframework.context.support.AbstractApplicationContext
addApplicationListener, addBeanFactoryPostProcessor, close, containsBean, containsBeanDefinition, containsLocalBean, createEnvironment, destroyBeans, doClose, findAllAnnotationsOnBean, findAnnotationOnBean, findAnnotationOnBean, finishBeanFactoryInitialization, finishRefresh, getAliases, getApplicationListeners, getApplicationName, getApplicationStartup, getAutowireCapableBeanFactory, getBean, getBean, getBean, getBean, getBean, getBeanDefinitionCount, getBeanDefinitionNames, getBeanFactoryPostProcessors, getBeanNamesForAnnotation, getBeanNamesForType, getBeanNamesForType, getBeanNamesForType, getBeanNamesForType, getBeanProvider, getBeanProvider, getBeanProvider, getBeanProvider, getBeansOfType, getBeansOfType, getBeansWithAnnotation, getDisplayName, getEnvironment, getId, getInternalParentBeanFactory, getInternalParentMessageSource, getMessage, getMessage, getMessage, getParent, getParentBeanFactory, getResourcePatternResolver, getResources, getStartupDate, getType, getType, initApplicationEventMulticaster, initLifecycleProcessor, initMessageSource, initPropertySources, invokeBeanFactoryPostProcessors, isActive, isPrototype, isRunning, isSingleton, isTypeMatch, isTypeMatch, obtainFreshBeanFactory, onClose, postProcessBeanFactory, prepareBeanFactory, publishEvent, publishEvent, publishEvent, refresh, registerBeanPostProcessors, registerListeners, registerShutdownHook, removeApplicationListener, resetCommonCaches, setApplicationStartup, setDisplayName, setEnvironment, setParent, start, stop, toStringMethods inherited from class org.springframework.core.io.DefaultResourceLoader
addProtocolResolver, clearResourceCaches, getClassLoader, getProtocolResolvers, getResource, getResourceByPath, getResourceCache, setClassLoaderMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.springframework.context.ConfigurableApplicationContext
addProtocolResolver, setClassLoaderMethods inherited from interface org.springframework.core.io.ResourceLoader
getClassLoader, getResource
-
Field Details
-
DEFAULT_COPY_CONFIGURATION
protected static final boolean DEFAULT_COPY_CONFIGURATION- See Also:
-
USE_DEFAULT_FILTERS
protected static final boolean USE_DEFAULT_FILTERS- See Also:
-
-
Constructor Details
-
RefreshableAnnotationConfigApplicationContext
public RefreshableAnnotationConfigApplicationContext()Constructs an new instance of theRefreshableAnnotationConfigApplicationContextwith default container state and no parentApplicationContext. -
RefreshableAnnotationConfigApplicationContext
public RefreshableAnnotationConfigApplicationContext(@Nullable org.springframework.context.ApplicationContext parent) Constructs a new instance of theRefreshableAnnotationConfigApplicationContextinitialized with the parentApplicationContext. Additionally, this constructor eagerly initializes aConfigurableListableBeanFactory, unlikeAbstractRefreshableApplicationContextimplementations, but exactly likeGenericApplicationContextimplementations.- Parameters:
parent- parentApplicationContextto this child context.- See Also:
-
ApplicationContextAbstractRefreshableApplicationContext.refreshBeanFactory()
-
-
Method Details
-
setBeanNameGenerator
public void setBeanNameGenerator(@Nullable org.springframework.beans.factory.support.BeanNameGenerator beanNameGenerator) Configures theBeanNameGeneratorstrategy used by thisApplicationContextto generatebean namesforbean definitions.- Parameters:
beanNameGenerator-BeanNameGeneratorused to generatebean namesforbean definitions.- See Also:
-
BeanNameGenerator
-
getBeanNameGenerator
protected Optional<org.springframework.beans.factory.support.BeanNameGenerator> getBeanNameGenerator()Returns theoptionallyconfiguredBeanNameGeneratorstrategy used by thisApplicationContextto generatebean namesforbean definitions.- Returns:
- the
BeanNameGeneratorstrategy used to generatebean namesforbean definitions. - See Also:
-
BeanNameGeneratorOptional
-
getLogger
@NonNull protected org.slf4j.Logger getLogger()Returns the configuredLoggerused to log framework messages to the application log.- Returns:
- the configured
Logger. - See Also:
-
Logger
-
setScopeMetadataResolver
public void setScopeMetadataResolver(@Nullable org.springframework.context.annotation.ScopeMetadataResolver scopeMetadataResolver) Configures theScopeMetadataResolverstrategy used by thisApplicationContextto resolve the scope forbean definitions.- Parameters:
scopeMetadataResolver-ScopeMetadataResolverused to resolve the scope ofbean definitions.- See Also:
-
ScopeMetadataResolver
-
getScopeMetadataResolver
public Optional<org.springframework.context.annotation.ScopeMetadataResolver> getScopeMetadataResolver()Returns theoptionallyconfiguredScopeMetadataResolverstrategy used by thisApplicationContextto resolve the scope forbean definitions.- Returns:
- the configured
ScopeMetadataResolverused to resolve the scope forbean definitions. - See Also:
-
ScopeMetadataResolverOptional
-
isCopyConfigurationEnabled
protected boolean isCopyConfigurationEnabled() -
isUsingDefaultFilters
protected boolean isUsingDefaultFilters() -
loadBeanDefinitions
protected void loadBeanDefinitions(org.springframework.beans.factory.support.DefaultListableBeanFactory beanFactory) throws org.springframework.beans.BeansException LoadsBeanDefinitionsfrom Annotation configuration (component) classes as well as from other resource locations (e.g. XML).- Specified by:
loadBeanDefinitionsin classorg.springframework.context.support.AbstractRefreshableApplicationContext- Parameters:
beanFactory-DefaultListableBeanFactoryto configure.- Throws:
org.springframework.beans.BeansException- if loading and configuring theBeanDefintionsfor the targetDefaultListableBeanFactoryfails.- See Also:
-
DefaultListableBeanFactorynewAnnotatedBeanDefinitionReader(BeanDefinitionRegistry)newClassBeanDefinitionScanner(BeanDefinitionRegistry)AbstractRefreshableConfigApplicationContext.getConfigLocations()
-
newAnnotatedBeanDefinitionReader
protected org.springframework.context.annotation.AnnotatedBeanDefinitionReader newAnnotatedBeanDefinitionReader(org.springframework.beans.factory.support.BeanDefinitionRegistry registry) -
newClassBeanDefinitionScanner
protected org.springframework.context.annotation.ClassPathBeanDefinitionScanner newClassBeanDefinitionScanner(org.springframework.beans.factory.support.BeanDefinitionRegistry registry) -
onRefresh
protected void onRefresh()Re-registers Singleton beans registered with the previousBeanFactory(prior to refresh) with thisApplicationContext, iff this context was previously active and subsequently refreshed.- Overrides:
onRefreshin classorg.springframework.context.support.AbstractApplicationContext- See Also:
-
ConfigurableBeanFactory.copyConfigurationFrom(ConfigurableBeanFactory)SingletonBeanRegistry.registerSingleton(String, Object)AbstractRefreshableApplicationContext.getBeanFactory()
-
prepareRefresh
protected void prepareRefresh()Stores a reference to the previousConfigurableListableBeanFactoryin order to copy its configuration and state onApplicationContextrefresh invocations.- Overrides:
prepareRefreshin classorg.springframework.context.support.AbstractApplicationContext- See Also:
-
AbstractRefreshableApplicationContext.getBeanFactory()
-
register
- Specified by:
registerin interfaceorg.springframework.context.annotation.AnnotationConfigRegistry
-
scan
- Specified by:
scanin interfaceorg.springframework.context.annotation.AnnotationConfigRegistry
-