public class AutomaticJobRegistrar
extends java.lang.Object
implements org.springframework.core.Ordered, org.springframework.context.SmartLifecycle, org.springframework.context.ApplicationContextAware, org.springframework.beans.factory.InitializingBean
Jobs when the application context is created and destroyed. Each resource provided is
loaded as an application context with the current context as its parent, and then all the jobs from the child context
are registered under their bean names. A JobRegistry is required.| Constructor and Description |
|---|
AutomaticJobRegistrar() |
| Modifier and Type | Method and Description |
|---|---|
void |
addApplicationContextFactory(ApplicationContextFactory applicationContextFactory)
Add some factories to the set that will be used to load contexts and jobs.
|
void |
afterPropertiesSet() |
int |
getOrder() |
int |
getPhase() |
boolean |
isAutoStartup() |
boolean |
isRunning()
Check if this component has been started.
|
void |
setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
The enclosing application context, which can be used to check if
events come
from the expected source. |
void |
setApplicationContextFactories(ApplicationContextFactory[] applicationContextFactories)
Add some factories to the set that will be used to load contexts and jobs.
|
void |
setAutoStartup(boolean autoStartup) |
void |
setJobLoader(JobLoader jobLoader)
The job loader that will be used to load and manage jobs.
|
void |
setOrder(int order)
The order to start up and shutdown.
|
void |
setPhase(int phase) |
void |
start()
Take all the contexts from the factories provided and pass them to the
JobLoader. |
void |
stop()
Delegates to
JobLoader.clear(). |
void |
stop(java.lang.Runnable callback) |
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
events come
from the expected source.setApplicationContext in interface org.springframework.context.ApplicationContextAwareapplicationContext - the enclosing application context if there is oneApplicationContextAware.setApplicationContext(ApplicationContext)public void addApplicationContextFactory(ApplicationContextFactory applicationContextFactory)
applicationContextFactory - the ApplicationContextFactory values to usepublic void setApplicationContextFactories(ApplicationContextFactory[] applicationContextFactories)
applicationContextFactories - the ApplicationContextFactory values to usepublic void setJobLoader(JobLoader jobLoader)
jobLoader - the JobLoader to setpublic int getOrder()
getOrder in interface org.springframework.core.Orderedpublic void setOrder(int order)
order - the order (default Ordered.LOWEST_PRECEDENCE).Orderedpublic void afterPropertiesSet()
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBeanpublic void stop()
JobLoader.clear().stop in interface org.springframework.context.LifecycleLifecycle.stop()public void start()
JobLoader.start in interface org.springframework.context.LifecycleLifecycle.start()public boolean isRunning()
isRunning in interface org.springframework.context.LifecycleLifecycle.isRunning()public boolean isAutoStartup()
isAutoStartup in interface org.springframework.context.SmartLifecyclepublic void setAutoStartup(boolean autoStartup)
autoStartup - true for auto start.isAutoStartup()public int getPhase()
getPhase in interface org.springframework.context.PhasedgetPhase in interface org.springframework.context.SmartLifecyclepublic void setPhase(int phase)
phase - the phase.getPhase()public void stop(java.lang.Runnable callback)
stop in interface org.springframework.context.SmartLifecycle