public class SpringRegistry extends AbstractRegistry implements Injector
| Modifier and Type | Field and Description |
|---|---|
protected org.springframework.context.ApplicationContext |
applicationContext |
static String |
REGISTRY_ID |
static String |
SPRING_APPLICATION_CONTEXT
Key used to lookup Spring Application Context from SpringRegistry via Mule's Registry interface.
|
protected AtomicBoolean |
springContextInitialised |
logger, muleContext| Constructor and Description |
|---|
SpringRegistry(org.springframework.context.ApplicationContext applicationContext,
MuleContext muleContext,
ConfigurationDependencyResolver dependencyResolver,
LifecycleInterceptor lifecycleInterceptor) |
| Modifier and Type | Method and Description |
|---|---|
Object |
applyLifecycle(Object object)
Will fire any lifecycle methods according to the current lifecycle without actually registering the object in the registry.
|
Object |
applyLifecycle(Object object,
String phase) |
void |
applyLifecycle(Object object,
String startPhase,
String toPhase) |
protected LifecycleManager |
createLifecycleManager(LifecycleInterceptor lifecycleInterceptor) |
void |
doDispose() |
protected void |
doInitialise() |
protected Object |
doUnregisterObject(String key) |
protected org.springframework.context.ApplicationContext |
getApplicationContext() |
BeanDependencyResolver |
getBeanDependencyResolver() |
ConfigurationDependencyResolver |
getConfigurationDependencyResolver() |
Map<String,Object> |
getDependencies(String key) |
<T> T |
inject(T object) |
protected <T> Map<String,T> |
internalLookupByType(Class<T> type,
boolean nonSingletons,
boolean eagerInit) |
protected <T> Map<String,T> |
internalLookupByTypeWithoutAncestorsAndObjectProviders(Class<T> type,
boolean nonSingletons,
boolean eagerInit) |
boolean |
isReadOnly() |
boolean |
isRemote() |
boolean |
isSingleton(String key) |
<T> Map<String,T> |
lookupByType(Class<T> type) |
<T> Map<String,T> |
lookupEntriesForLifecycle(Class<T> type) |
<T> Collection<T> |
lookupLocalObjects(Class<T> type) |
<T> T |
lookupObject(String key) |
Object |
lookupObject(String key,
boolean applyLifecycle)
If looks for the bean registered under
key. |
<T> Collection<T> |
lookupObjects(Class<T> type) |
<T> Collection<T> |
lookupObjectsForLifecycle(Class<T> type)
For lifecycle we only want spring to return singleton objects from it's application context
|
void |
registerObject(String key,
Object value) |
void |
registerObject(String key,
Object value,
Object metadata) |
void |
registerObjects(Map<String,Object> objects) |
dispose, fireLifecycle, get, getLifecycleManager, getRegistryId, initialise, isInitialised, lookupObject, unregisterObject, unregisterObjectpublic static final String REGISTRY_ID
public static final String SPRING_APPLICATION_CONTEXT
protected org.springframework.context.ApplicationContext applicationContext
protected AtomicBoolean springContextInitialised
public SpringRegistry(org.springframework.context.ApplicationContext applicationContext,
MuleContext muleContext,
ConfigurationDependencyResolver dependencyResolver,
LifecycleInterceptor lifecycleInterceptor)
protected void doInitialise()
throws org.mule.runtime.api.lifecycle.InitialisationException
doInitialise in class AbstractRegistryorg.mule.runtime.api.lifecycle.InitialisationExceptionpublic void doDispose()
doDispose in class AbstractRegistryprotected LifecycleManager createLifecycleManager(LifecycleInterceptor lifecycleInterceptor)
createLifecycleManager in class AbstractRegistrypublic <T> T lookupObject(String key)
lookupObject in interface RegistrylookupObject(String, boolean) with true as the second argumentpublic Object lookupObject(String key, boolean applyLifecycle)
key. If the returned bean is a prototype and applyLifecycle is
true, then the completed lifecycle phases are applied to the returning beanlookupObject in interface Registrykey - the key of the object you're looking forapplyLifecycle - if lifecycle should be applied to the returned object. Passing true doesn't guarantee that the
lifecycle is appliednull if not foundpublic <T> Collection<T> lookupObjects(Class<T> type)
lookupObjects in interface Registrypublic <T> Collection<T> lookupLocalObjects(Class<T> type)
lookupLocalObjects in interface Registrypublic <T> Collection<T> lookupObjectsForLifecycle(Class<T> type)
lookupObjectsForLifecycle in interface RegistrylookupObjectsForLifecycle in class AbstractRegistrypublic <T> Map<String,T> lookupByType(Class<T> type)
lookupByType in interface Registrypublic boolean isSingleton(String key)
isSingleton in interface Registrypublic void registerObject(String key, Object value) throws RegistrationException
registerObject in interface RegistryRegistrationExceptionpublic void registerObject(String key, Object value, Object metadata) throws RegistrationException
registerObject in interface RegistryRegistrationExceptionpublic void registerObjects(Map<String,Object> objects) throws RegistrationException
registerObjects in interface RegistryRegistrationExceptionprotected Object doUnregisterObject(String key) throws RegistrationException
doUnregisterObject in class AbstractRegistryRegistrationExceptionpublic Object applyLifecycle(Object object) throws org.mule.runtime.api.exception.MuleException
applyLifecycle in interface Registryobject - the object to processorg.mule.runtime.api.exception.MuleException - if the registry fails to perform the lifecycle change for the object.public Object applyLifecycle(Object object, String phase) throws org.mule.runtime.api.exception.MuleException
applyLifecycle in interface Registryorg.mule.runtime.api.exception.MuleExceptionpublic void applyLifecycle(Object object, String startPhase, String toPhase) throws org.mule.runtime.api.exception.MuleException
applyLifecycle in interface Registryorg.mule.runtime.api.exception.MuleExceptionprotected <T> Map<String,T> internalLookupByType(Class<T> type, boolean nonSingletons, boolean eagerInit)
protected <T> Map<String,T> internalLookupByTypeWithoutAncestorsAndObjectProviders(Class<T> type, boolean nonSingletons, boolean eagerInit)
public BeanDependencyResolver getBeanDependencyResolver()
public ConfigurationDependencyResolver getConfigurationDependencyResolver()
protected org.springframework.context.ApplicationContext getApplicationContext()
public boolean isReadOnly()
isReadOnly in interface RegistryCopyright © 2003–2022 MuleSoft, Inc.. All rights reserved.