@Singleton @Secondary public class MicronautApplicationContext extends java.lang.Object implements ManagedApplicationContext, org.springframework.context.ConfigurableApplicationContext
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.
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) |
java.lang.String[] |
getAliases(java.lang.String name) |
java.lang.String |
getApplicationName() |
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(org.springframework.core.ResolvableType requiredType) |
<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) |
void |
publishEvent(java.lang.Object event) |
void |
refresh() |
void |
registerShutdownHook() |
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.ApplicationContext
public java.lang.String getApplicationName()
getApplicationName
in interface org.springframework.context.ApplicationContext
public java.lang.String getDisplayName()
getDisplayName
in interface org.springframework.context.ApplicationContext
public long getStartupDate()
getStartupDate
in interface org.springframework.context.ApplicationContext
public org.springframework.context.ApplicationContext getParent()
getParent
in interface org.springframework.context.ApplicationContext
public org.springframework.beans.factory.config.AutowireCapableBeanFactory getAutowireCapableBeanFactory() throws java.lang.IllegalStateException
getAutowireCapableBeanFactory
in interface org.springframework.context.ApplicationContext
java.lang.IllegalStateException
public org.springframework.beans.factory.BeanFactory getParentBeanFactory()
getParentBeanFactory
in interface org.springframework.beans.factory.HierarchicalBeanFactory
public boolean containsLocalBean(java.lang.String name)
containsLocalBean
in interface org.springframework.beans.factory.HierarchicalBeanFactory
public boolean containsBeanDefinition(java.lang.String beanName)
containsBeanDefinition
in interface org.springframework.beans.factory.ListableBeanFactory
public int getBeanDefinitionCount()
getBeanDefinitionCount
in interface org.springframework.beans.factory.ListableBeanFactory
public java.lang.String[] getBeanDefinitionNames()
getBeanDefinitionNames
in interface org.springframework.beans.factory.ListableBeanFactory
public java.lang.String[] getBeanNamesForType(org.springframework.core.ResolvableType type)
getBeanNamesForType
in interface org.springframework.beans.factory.ListableBeanFactory
public java.lang.String[] getBeanNamesForType(org.springframework.core.ResolvableType type, boolean includeNonSingletons, boolean allowEagerInit)
getBeanNamesForType
in interface org.springframework.beans.factory.ListableBeanFactory
public java.lang.String[] getBeanNamesForType(java.lang.Class<?> type)
getBeanNamesForType
in interface org.springframework.beans.factory.ListableBeanFactory
public java.lang.String[] getBeanNamesForType(java.lang.Class<?> type, boolean includeNonSingletons, boolean allowEagerInit)
getBeanNamesForType
in interface org.springframework.beans.factory.ListableBeanFactory
public <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.ListableBeanFactory
org.springframework.beans.BeansException
public <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.ListableBeanFactory
org.springframework.beans.BeansException
public java.lang.String[] getBeanNamesForAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
getBeanNamesForAnnotation
in interface org.springframework.beans.factory.ListableBeanFactory
public 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.ListableBeanFactory
org.springframework.beans.BeansException
public <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.ListableBeanFactory
org.springframework.beans.factory.NoSuchBeanDefinitionException
public java.lang.Object getBean(java.lang.String name) throws org.springframework.beans.BeansException
getBean
in interface org.springframework.beans.factory.BeanFactory
org.springframework.beans.BeansException
public <T> T getBean(java.lang.String name, java.lang.Class<T> requiredType) throws org.springframework.beans.BeansException
getBean
in interface org.springframework.beans.factory.BeanFactory
org.springframework.beans.BeansException
public java.lang.Object getBean(java.lang.String name, java.lang.Object... args) throws org.springframework.beans.BeansException
getBean
in interface org.springframework.beans.factory.BeanFactory
org.springframework.beans.BeansException
public <T> T getBean(java.lang.Class<T> requiredType) throws org.springframework.beans.BeansException
getBean
in interface org.springframework.beans.factory.BeanFactory
org.springframework.beans.BeansException
public <T> T getBean(java.lang.Class<T> requiredType, java.lang.Object... args) throws org.springframework.beans.BeansException
getBean
in interface org.springframework.beans.factory.BeanFactory
org.springframework.beans.BeansException
public <T> org.springframework.beans.factory.ObjectProvider<T> getBeanProvider(java.lang.Class<T> requiredType)
getBeanProvider
in interface org.springframework.beans.factory.BeanFactory
public <T> org.springframework.beans.factory.ObjectProvider<T> getBeanProvider(org.springframework.core.ResolvableType requiredType)
getBeanProvider
in interface org.springframework.beans.factory.BeanFactory
public boolean containsBean(java.lang.String name)
containsBean
in interface org.springframework.beans.factory.BeanFactory
public boolean isSingleton(java.lang.String name) throws org.springframework.beans.factory.NoSuchBeanDefinitionException
isSingleton
in interface org.springframework.beans.factory.BeanFactory
org.springframework.beans.factory.NoSuchBeanDefinitionException
public boolean isPrototype(java.lang.String name) throws org.springframework.beans.factory.NoSuchBeanDefinitionException
isPrototype
in interface org.springframework.beans.factory.BeanFactory
org.springframework.beans.factory.NoSuchBeanDefinitionException
public boolean isTypeMatch(java.lang.String name, org.springframework.core.ResolvableType typeToMatch) throws org.springframework.beans.factory.NoSuchBeanDefinitionException
isTypeMatch
in interface org.springframework.beans.factory.BeanFactory
org.springframework.beans.factory.NoSuchBeanDefinitionException
public boolean isTypeMatch(java.lang.String name, java.lang.Class<?> typeToMatch) throws org.springframework.beans.factory.NoSuchBeanDefinitionException
isTypeMatch
in interface org.springframework.beans.factory.BeanFactory
org.springframework.beans.factory.NoSuchBeanDefinitionException
public java.lang.Class<?> getType(java.lang.String name) throws org.springframework.beans.factory.NoSuchBeanDefinitionException
getType
in interface org.springframework.beans.factory.BeanFactory
org.springframework.beans.factory.NoSuchBeanDefinitionException
public java.lang.Class<?> getType(java.lang.String name, boolean allowFactoryBeanInit) throws org.springframework.beans.factory.NoSuchBeanDefinitionException
getType
in interface org.springframework.beans.factory.BeanFactory
org.springframework.beans.factory.NoSuchBeanDefinitionException
public java.lang.String[] getAliases(java.lang.String name)
getAliases
in interface org.springframework.beans.factory.BeanFactory
public void publishEvent(java.lang.Object event)
publishEvent
in interface org.springframework.context.ApplicationEventPublisher
public 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.MessageSource
public 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.MessageSource
org.springframework.context.NoSuchMessageException
public java.lang.String getMessage(org.springframework.context.MessageSourceResolvable resolvable, java.util.Locale locale) throws org.springframework.context.NoSuchMessageException
getMessage
in interface org.springframework.context.MessageSource
org.springframework.context.NoSuchMessageException
public void setId(java.lang.String id)
setId
in interface org.springframework.context.ConfigurableApplicationContext
public void setParent(org.springframework.context.ApplicationContext parent)
setParent
in interface org.springframework.context.ConfigurableApplicationContext
public void setEnvironment(org.springframework.core.env.ConfigurableEnvironment environment)
setEnvironment
in interface org.springframework.context.ConfigurableApplicationContext
public org.springframework.core.env.ConfigurableEnvironment getEnvironment()
getEnvironment
in interface org.springframework.context.ConfigurableApplicationContext
getEnvironment
in interface org.springframework.core.env.EnvironmentCapable
public void addBeanFactoryPostProcessor(org.springframework.beans.factory.config.BeanFactoryPostProcessor postProcessor)
addBeanFactoryPostProcessor
in interface org.springframework.context.ConfigurableApplicationContext
public void addApplicationListener(org.springframework.context.ApplicationListener<?> listener)
addApplicationListener
in interface org.springframework.context.ConfigurableApplicationContext
public void addProtocolResolver(org.springframework.core.io.ProtocolResolver resolver)
addProtocolResolver
in interface org.springframework.context.ConfigurableApplicationContext
public void refresh() throws org.springframework.beans.BeansException, java.lang.IllegalStateException
refresh
in interface org.springframework.context.ConfigurableApplicationContext
org.springframework.beans.BeansException
java.lang.IllegalStateException
public void registerShutdownHook()
registerShutdownHook
in interface org.springframework.context.ConfigurableApplicationContext
public org.springframework.core.io.Resource[] getResources(java.lang.String locationPattern) throws java.io.IOException
getResources
in interface org.springframework.core.io.support.ResourcePatternResolver
java.io.IOException
public org.springframework.core.io.Resource getResource(java.lang.String location)
getResource
in interface org.springframework.core.io.ResourceLoader
public java.lang.ClassLoader getClassLoader()
getClassLoader
in interface org.springframework.core.io.ResourceLoader
public void close()
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in interface org.springframework.context.ConfigurableApplicationContext
public boolean isActive()
isActive
in interface org.springframework.context.ConfigurableApplicationContext
public org.springframework.beans.factory.config.ConfigurableListableBeanFactory getBeanFactory() throws java.lang.IllegalStateException
getBeanFactory
in interface org.springframework.context.ConfigurableApplicationContext
java.lang.IllegalStateException
public void start()
start
in interface org.springframework.context.Lifecycle
public void stop()
stop
in interface org.springframework.context.Lifecycle
public boolean isRunning()
isRunning
in interface org.springframework.context.Lifecycle