public abstract class SimpleModule extends AbstractModule
Module
implementation backed by a Spring ApplicationContext
.Constructor and Description |
---|
SimpleModule(ModuleDescriptor descriptor,
ModuleDeploymentProperties deploymentProperties) |
SimpleModule(ModuleDescriptor descriptor,
ModuleDeploymentProperties deploymentProperties,
java.lang.ClassLoader classLoader,
ModuleOptions moduleOptions) |
Modifier and Type | Method and Description |
---|---|
void |
addListener(org.springframework.context.ApplicationListener<?> listener)
Add an application listener to the application context.
|
void |
addProperties(java.util.Properties properties)
Add properties to the environment.
|
void |
addSource(java.lang.Object source) |
protected abstract void |
configureModuleApplicationContext(ModuleDefinition moduleDefinition)
Subclasses implement this method to configure the application context from sources contained in the
ModuleDefinition |
void |
destroy()
Destroy this module's application context.
|
org.springframework.context.ConfigurableApplicationContext |
getApplicationContext() |
<T> T |
getComponent(java.lang.Class<T> requiredType)
Get a bean instance by its class.
|
<T> T |
getComponent(java.lang.String componentName,
java.lang.Class<T> requiredType)
Get a bean instance by its name and class.
|
java.util.Properties |
getProperties()
Get the module's properties.
|
void |
initialize() |
boolean |
isRunning() |
void |
setParentContext(org.springframework.context.ApplicationContext parent)
set a parent application context
|
void |
start() |
void |
stop() |
getDeploymentProperties, getDescriptor, getName, getType, toString
public SimpleModule(ModuleDescriptor descriptor, ModuleDeploymentProperties deploymentProperties)
public SimpleModule(ModuleDescriptor descriptor, ModuleDeploymentProperties deploymentProperties, java.lang.ClassLoader classLoader, ModuleOptions moduleOptions)
protected abstract void configureModuleApplicationContext(ModuleDefinition moduleDefinition)
ModuleDefinition
moduleDefinition
- public void setParentContext(org.springframework.context.ApplicationContext parent)
Module
public void addSource(java.lang.Object source)
source
- can be a configuration class, bean definition Resource
(e.g. XML or groovy file), or an annotated component, or an array of such objects.SpringApplicationBuilder.sources
public void addProperties(java.util.Properties properties)
Module
public void addListener(org.springframework.context.ApplicationListener<?> listener)
Module
listener
- the listenerpublic java.util.Properties getProperties()
Module
public org.springframework.context.ConfigurableApplicationContext getApplicationContext()
public <T> T getComponent(java.lang.Class<T> requiredType)
Module
requiredType
- the class of the target beanpublic <T> T getComponent(java.lang.String componentName, java.lang.Class<T> requiredType)
Module
componentName
- the name of the target beanrequiredType
- the class of the target beanpublic void initialize()
public void start()
public void stop()
public boolean isRunning()
public void destroy()
Module