@Singleton @Secondary public class MicronautApplicationContext extends java.lang.Object implements ManagedApplicationContext, org.springframework.context.ConfigurableApplicationContext, MicronautContextInternal
ApplicationContext interface that delegates to Micronaut.
This can either be created manually via MicronautApplicationContext(ApplicationContextBuilder) or looked up as a
bean when running from Micronaut. The ApplicationContextAware interface is supported.
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_NAME| Constructor and Description |
|---|
MicronautApplicationContext()
Default constructor.
|
MicronautApplicationContext(io.micronaut.context.ApplicationContextBuilder contextBuilder)
Customization constructor.
|
MicronautApplicationContext(io.micronaut.context.ApplicationContext micronautContext,
org.springframework.core.env.ConfigurableEnvironment environment,
MicronautBeanFactory beanFactory,
org.springframework.context.ApplicationEventPublisher eventPublisher,
org.springframework.context.MessageSource messageSource)
Default constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addApplicationListener(org.springframework.context.ApplicationListener<?> listener) |
void |
addBeanFactoryPostProcessor(org.springframework.beans.factory.config.BeanFactoryPostProcessor postProcessor) |
void |
addProtocolResolver(org.springframework.core.io.ProtocolResolver resolver) |
void |
close() |
boolean |
containsBean(java.lang.String name) |
boolean |
containsBeanDefinition(java.lang.String beanName) |
boolean |
containsLocalBean(java.lang.String name) |
<A extends java.lang.annotation.Annotation> |
findAnnotationOnBean(java.lang.String beanName,
java.lang.Class<A> annotationType) |
<A extends java.lang.annotation.Annotation> |
findAnnotationOnBean(java.lang.String beanName,
java.lang.Class<A> annotationType,
boolean allowFactoryBeanInit) |
java.lang.String[] |
getAliases(java.lang.String name) |
java.lang.String |
getApplicationName() |
org.springframework.core.metrics.ApplicationStartup |
getApplicationStartup() |
org.springframework.beans.factory.config.AutowireCapableBeanFactory |
getAutowireCapableBeanFactory() |
<T> T |
getBean(java.lang.Class<T> requiredType) |
<T> T |
getBean(java.lang.Class<T> requiredType,
java.lang.Object... args) |
java.lang.Object |
getBean(java.lang.String name) |
<T> T |
getBean(java.lang.String name,
java.lang.Class<T> requiredType) |
java.lang.Object |
getBean(java.lang.String name,
java.lang.Object... args) |
int |
getBeanDefinitionCount() |
java.lang.String[] |
getBeanDefinitionNames() |
org.springframework.beans.factory.config.ConfigurableListableBeanFactory |
getBeanFactory() |
java.lang.String[] |
getBeanNamesForAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType) |
java.lang.String[] |
getBeanNamesForType(java.lang.Class<?> type) |
java.lang.String[] |
getBeanNamesForType(java.lang.Class<?> type,
boolean includeNonSingletons,
boolean allowEagerInit) |
java.lang.String[] |
getBeanNamesForType(org.springframework.core.ResolvableType type) |
java.lang.String[] |
getBeanNamesForType(org.springframework.core.ResolvableType type,
boolean includeNonSingletons,
boolean allowEagerInit) |
<T> org.springframework.beans.factory.ObjectProvider<T> |
getBeanProvider(java.lang.Class<T> requiredType) |
<T> org.springframework.beans.factory.ObjectProvider<T> |
getBeanProvider(java.lang.Class<T> requiredType,
boolean allowEagerInit) |
<T> org.springframework.beans.factory.ObjectProvider<T> |
getBeanProvider(org.springframework.core.ResolvableType requiredType) |
<T> org.springframework.beans.factory.ObjectProvider<T> |
getBeanProvider(org.springframework.core.ResolvableType requiredType,
boolean allowEagerInit) |
<T> java.util.Map<java.lang.String,T> |
getBeansOfType(java.lang.Class<T> type) |
<T> java.util.Map<java.lang.String,T> |
getBeansOfType(java.lang.Class<T> type,
boolean includeNonSingletons,
boolean allowEagerInit) |
java.util.Map<java.lang.String,java.lang.Object> |
getBeansWithAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType) |
java.lang.ClassLoader |
getClassLoader() |
java.lang.String |
getDisplayName() |
org.springframework.core.env.ConfigurableEnvironment |
getEnvironment() |
java.lang.String |
getId() |
java.lang.String |
getMessage(org.springframework.context.MessageSourceResolvable resolvable,
java.util.Locale locale) |
java.lang.String |
getMessage(java.lang.String code,
java.lang.Object[] args,
java.util.Locale locale) |
java.lang.String |
getMessage(java.lang.String code,
java.lang.Object[] args,
java.lang.String defaultMessage,
java.util.Locale locale) |
org.springframework.context.ApplicationContext |
getParent() |
org.springframework.beans.factory.BeanFactory |
getParentBeanFactory() |
org.springframework.core.io.Resource |
getResource(java.lang.String location) |
org.springframework.core.io.Resource[] |
getResources(java.lang.String locationPattern) |
long |
getStartupDate() |
java.lang.Class<?> |
getType(java.lang.String name) |
java.lang.Class<?> |
getType(java.lang.String name,
boolean allowFactoryBeanInit) |
boolean |
isActive() |
boolean |
isPrototype(java.lang.String name) |
boolean |
isRunning() |
boolean |
isSingleton(java.lang.String name) |
boolean |
isTypeMatch(java.lang.String name,
java.lang.Class<?> typeToMatch) |
boolean |
isTypeMatch(java.lang.String name,
org.springframework.core.ResolvableType typeToMatch) |
protected void |
onStartup(io.micronaut.context.event.StartupEvent startupEvent)
Method executed on startup.
|
void |
publishEvent(java.lang.Object event) |
void |
refresh() |
void |
registerShutdownHook() |
void |
setApplicationStartup(org.springframework.core.metrics.ApplicationStartup applicationStartup) |
void |
setClassLoader(java.lang.ClassLoader classLoader) |
void |
setEnvironment(org.springframework.core.env.ConfigurableEnvironment environment) |
void |
setId(java.lang.String id) |
void |
setParent(org.springframework.context.ApplicationContext parent) |
void |
start() |
void |
stop() |
@Inject
public MicronautApplicationContext(io.micronaut.context.ApplicationContext micronautContext,
org.springframework.core.env.ConfigurableEnvironment environment,
MicronautBeanFactory beanFactory,
org.springframework.context.ApplicationEventPublisher eventPublisher,
@Nullable
org.springframework.context.MessageSource messageSource)
micronautContext - The micronaut context to delegate toenvironment - The environmentbeanFactory - The bean factoryeventPublisher - The event publishermessageSource - The message sourcepublic MicronautApplicationContext()
public MicronautApplicationContext(io.micronaut.context.ApplicationContextBuilder contextBuilder)
contextBuilder - The context builderpublic java.lang.String getId()
getId in interface org.springframework.context.ApplicationContextpublic java.lang.String getApplicationName()
getApplicationName in interface org.springframework.context.ApplicationContextpublic java.lang.String getDisplayName()
getDisplayName in interface org.springframework.context.ApplicationContextpublic long getStartupDate()
getStartupDate in interface org.springframework.context.ApplicationContextpublic org.springframework.context.ApplicationContext getParent()
getParent in interface org.springframework.context.ApplicationContextpublic org.springframework.beans.factory.config.AutowireCapableBeanFactory getAutowireCapableBeanFactory()
throws java.lang.IllegalStateException
getAutowireCapableBeanFactory in interface org.springframework.context.ApplicationContextjava.lang.IllegalStateExceptionpublic org.springframework.beans.factory.BeanFactory getParentBeanFactory()
getParentBeanFactory in interface org.springframework.beans.factory.HierarchicalBeanFactorypublic boolean containsLocalBean(java.lang.String name)
containsLocalBean in interface org.springframework.beans.factory.HierarchicalBeanFactorypublic boolean containsBeanDefinition(java.lang.String beanName)
containsBeanDefinition in interface org.springframework.beans.factory.ListableBeanFactorypublic int getBeanDefinitionCount()
getBeanDefinitionCount in interface org.springframework.beans.factory.ListableBeanFactorypublic java.lang.String[] getBeanDefinitionNames()
getBeanDefinitionNames in interface org.springframework.beans.factory.ListableBeanFactorypublic <T> org.springframework.beans.factory.ObjectProvider<T> getBeanProvider(java.lang.Class<T> requiredType,
boolean allowEagerInit)
getBeanProvider in interface org.springframework.beans.factory.ListableBeanFactorypublic <T> org.springframework.beans.factory.ObjectProvider<T> getBeanProvider(org.springframework.core.ResolvableType requiredType,
boolean allowEagerInit)
getBeanProvider in interface org.springframework.beans.factory.ListableBeanFactorypublic java.lang.String[] getBeanNamesForType(org.springframework.core.ResolvableType type)
getBeanNamesForType in interface org.springframework.beans.factory.ListableBeanFactorypublic java.lang.String[] getBeanNamesForType(org.springframework.core.ResolvableType type,
boolean includeNonSingletons,
boolean allowEagerInit)
getBeanNamesForType in interface org.springframework.beans.factory.ListableBeanFactorypublic java.lang.String[] getBeanNamesForType(java.lang.Class<?> type)
getBeanNamesForType in interface org.springframework.beans.factory.ListableBeanFactorypublic java.lang.String[] getBeanNamesForType(java.lang.Class<?> type,
boolean includeNonSingletons,
boolean allowEagerInit)
getBeanNamesForType in interface org.springframework.beans.factory.ListableBeanFactorypublic <T> java.util.Map<java.lang.String,T> getBeansOfType(java.lang.Class<T> type)
throws org.springframework.beans.BeansException
getBeansOfType in interface org.springframework.beans.factory.ListableBeanFactoryorg.springframework.beans.BeansExceptionpublic <T> java.util.Map<java.lang.String,T> getBeansOfType(java.lang.Class<T> type,
boolean includeNonSingletons,
boolean allowEagerInit)
throws org.springframework.beans.BeansException
getBeansOfType in interface org.springframework.beans.factory.ListableBeanFactoryorg.springframework.beans.BeansExceptionpublic java.lang.String[] getBeanNamesForAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
getBeanNamesForAnnotation in interface org.springframework.beans.factory.ListableBeanFactorypublic java.util.Map<java.lang.String,java.lang.Object> getBeansWithAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
throws org.springframework.beans.BeansException
getBeansWithAnnotation in interface org.springframework.beans.factory.ListableBeanFactoryorg.springframework.beans.BeansExceptionpublic <A extends java.lang.annotation.Annotation> A findAnnotationOnBean(java.lang.String beanName,
java.lang.Class<A> annotationType)
throws org.springframework.beans.factory.NoSuchBeanDefinitionException
findAnnotationOnBean in interface org.springframework.beans.factory.ListableBeanFactoryorg.springframework.beans.factory.NoSuchBeanDefinitionExceptionpublic <A extends java.lang.annotation.Annotation> A findAnnotationOnBean(java.lang.String beanName,
java.lang.Class<A> annotationType,
boolean allowFactoryBeanInit)
throws org.springframework.beans.factory.NoSuchBeanDefinitionException
findAnnotationOnBean in interface org.springframework.beans.factory.ListableBeanFactoryorg.springframework.beans.factory.NoSuchBeanDefinitionExceptionpublic java.lang.Object getBean(java.lang.String name)
throws org.springframework.beans.BeansException
getBean in interface org.springframework.beans.factory.BeanFactoryorg.springframework.beans.BeansExceptionpublic <T> T getBean(java.lang.String name,
java.lang.Class<T> requiredType)
throws org.springframework.beans.BeansException
getBean in interface org.springframework.beans.factory.BeanFactoryorg.springframework.beans.BeansExceptionpublic java.lang.Object getBean(java.lang.String name,
java.lang.Object... args)
throws org.springframework.beans.BeansException
getBean in interface org.springframework.beans.factory.BeanFactoryorg.springframework.beans.BeansExceptionpublic <T> T getBean(java.lang.Class<T> requiredType)
throws org.springframework.beans.BeansException
getBean in interface org.springframework.beans.factory.BeanFactoryorg.springframework.beans.BeansExceptionpublic <T> T getBean(java.lang.Class<T> requiredType,
java.lang.Object... args)
throws org.springframework.beans.BeansException
getBean in interface org.springframework.beans.factory.BeanFactoryorg.springframework.beans.BeansExceptionpublic <T> org.springframework.beans.factory.ObjectProvider<T> getBeanProvider(java.lang.Class<T> requiredType)
getBeanProvider in interface org.springframework.beans.factory.BeanFactorypublic <T> org.springframework.beans.factory.ObjectProvider<T> getBeanProvider(org.springframework.core.ResolvableType requiredType)
getBeanProvider in interface org.springframework.beans.factory.BeanFactorypublic boolean containsBean(java.lang.String name)
containsBean in interface org.springframework.beans.factory.BeanFactorypublic boolean isSingleton(java.lang.String name)
throws org.springframework.beans.factory.NoSuchBeanDefinitionException
isSingleton in interface org.springframework.beans.factory.BeanFactoryorg.springframework.beans.factory.NoSuchBeanDefinitionExceptionpublic boolean isPrototype(java.lang.String name)
throws org.springframework.beans.factory.NoSuchBeanDefinitionException
isPrototype in interface org.springframework.beans.factory.BeanFactoryorg.springframework.beans.factory.NoSuchBeanDefinitionExceptionpublic boolean isTypeMatch(java.lang.String name,
org.springframework.core.ResolvableType typeToMatch)
throws org.springframework.beans.factory.NoSuchBeanDefinitionException
isTypeMatch in interface org.springframework.beans.factory.BeanFactoryorg.springframework.beans.factory.NoSuchBeanDefinitionExceptionpublic boolean isTypeMatch(java.lang.String name,
java.lang.Class<?> typeToMatch)
throws org.springframework.beans.factory.NoSuchBeanDefinitionException
isTypeMatch in interface org.springframework.beans.factory.BeanFactoryorg.springframework.beans.factory.NoSuchBeanDefinitionExceptionpublic java.lang.Class<?> getType(java.lang.String name)
throws org.springframework.beans.factory.NoSuchBeanDefinitionException
getType in interface org.springframework.beans.factory.BeanFactoryorg.springframework.beans.factory.NoSuchBeanDefinitionExceptionpublic java.lang.Class<?> getType(java.lang.String name,
boolean allowFactoryBeanInit)
throws org.springframework.beans.factory.NoSuchBeanDefinitionException
getType in interface org.springframework.beans.factory.BeanFactoryorg.springframework.beans.factory.NoSuchBeanDefinitionExceptionpublic java.lang.String[] getAliases(java.lang.String name)
getAliases in interface org.springframework.beans.factory.BeanFactorypublic void publishEvent(java.lang.Object event)
publishEvent in interface org.springframework.context.ApplicationEventPublisherpublic java.lang.String getMessage(java.lang.String code,
java.lang.Object[] args,
java.lang.String defaultMessage,
java.util.Locale locale)
getMessage in interface org.springframework.context.MessageSourcepublic java.lang.String getMessage(java.lang.String code,
java.lang.Object[] args,
java.util.Locale locale)
throws org.springframework.context.NoSuchMessageException
getMessage in interface org.springframework.context.MessageSourceorg.springframework.context.NoSuchMessageExceptionpublic java.lang.String getMessage(org.springframework.context.MessageSourceResolvable resolvable,
java.util.Locale locale)
throws org.springframework.context.NoSuchMessageException
getMessage in interface org.springframework.context.MessageSourceorg.springframework.context.NoSuchMessageExceptionpublic void setId(java.lang.String id)
setId in interface org.springframework.context.ConfigurableApplicationContextpublic void setParent(org.springframework.context.ApplicationContext parent)
setParent in interface org.springframework.context.ConfigurableApplicationContextpublic void setEnvironment(org.springframework.core.env.ConfigurableEnvironment environment)
setEnvironment in interface org.springframework.context.ConfigurableApplicationContextpublic org.springframework.core.env.ConfigurableEnvironment getEnvironment()
getEnvironment in interface org.springframework.context.ConfigurableApplicationContextgetEnvironment in interface org.springframework.core.env.EnvironmentCapablepublic void setApplicationStartup(org.springframework.core.metrics.ApplicationStartup applicationStartup)
setApplicationStartup in interface org.springframework.context.ConfigurableApplicationContextpublic org.springframework.core.metrics.ApplicationStartup getApplicationStartup()
getApplicationStartup in interface org.springframework.context.ConfigurableApplicationContextpublic void addBeanFactoryPostProcessor(org.springframework.beans.factory.config.BeanFactoryPostProcessor postProcessor)
addBeanFactoryPostProcessor in interface org.springframework.context.ConfigurableApplicationContextpublic void addApplicationListener(org.springframework.context.ApplicationListener<?> listener)
addApplicationListener in interface org.springframework.context.ConfigurableApplicationContextpublic void setClassLoader(java.lang.ClassLoader classLoader)
setClassLoader in interface org.springframework.context.ConfigurableApplicationContextpublic void addProtocolResolver(org.springframework.core.io.ProtocolResolver resolver)
addProtocolResolver in interface org.springframework.context.ConfigurableApplicationContextpublic void refresh()
throws org.springframework.beans.BeansException,
java.lang.IllegalStateException
refresh in interface org.springframework.context.ConfigurableApplicationContextorg.springframework.beans.BeansExceptionjava.lang.IllegalStateExceptionpublic void registerShutdownHook()
registerShutdownHook in interface org.springframework.context.ConfigurableApplicationContextpublic org.springframework.core.io.Resource[] getResources(java.lang.String locationPattern)
throws java.io.IOException
getResources in interface org.springframework.core.io.support.ResourcePatternResolverjava.io.IOExceptionpublic org.springframework.core.io.Resource getResource(java.lang.String location)
getResource in interface org.springframework.core.io.ResourceLoaderpublic java.lang.ClassLoader getClassLoader()
getClassLoader in interface org.springframework.core.io.ResourceLoaderpublic void close()
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in interface org.springframework.context.ConfigurableApplicationContextpublic boolean isActive()
isActive in interface org.springframework.context.ConfigurableApplicationContextpublic org.springframework.beans.factory.config.ConfigurableListableBeanFactory getBeanFactory()
throws java.lang.IllegalStateException
getBeanFactory in interface org.springframework.context.ConfigurableApplicationContextjava.lang.IllegalStateExceptionpublic void start()
start in interface org.springframework.context.Lifecyclepublic void stop()
stop in interface org.springframework.context.Lifecyclepublic boolean isRunning()
isRunning in interface org.springframework.context.Lifecycle@EventListener protected void onStartup(io.micronaut.context.event.StartupEvent startupEvent)
startupEvent - The startup event.