|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.dellroad.stuff.main.MainClass
org.dellroad.stuff.main.ContextMainClass
public abstract class ContextMainClass
Support superclass for MainClass implementations that wish to execute
with an associated Spring application context.
| Field Summary | |
|---|---|
protected ClassPathXmlApplicationContext |
context
|
| Fields inherited from class org.dellroad.stuff.main.MainClass |
|---|
log |
| Constructor Summary | |
|---|---|
ContextMainClass()
|
|
| Method Summary | |
|---|---|
protected void |
autowire()
Autowire this instance using its associated application context. |
protected String |
getContextLocation()
Get the classpath location of this instance's associated XML application context. |
int |
run(String[] args)
Subclass main implementation. |
protected abstract int |
runInContext(String[] args)
Execute the main method. |
| Methods inherited from class org.dellroad.stuff.main.MainClass |
|---|
commandLoop, doMain, errout, handleCommand, parsePropertyFlags, usageError, usageMessage |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected ClassPathXmlApplicationContext context
| Constructor Detail |
|---|
public ContextMainClass()
| Method Detail |
|---|
protected String getContextLocation()
The implementation in ContextMainClass returns getClass().getSimpleName() + ".xml",
which will locate an XML file in the same package and with the same name.
protected void autowire()
runInContext(java.lang.String[]) to autowire this bean using its associated context.
For this to work, the application context must have autowiring enabled, e.g., via
<context:annotation-config/>.
public final int run(String[] args)
throws Exception
MainClass
run in class MainClassException
protected abstract int runInContext(String[] args)
throws Exception
Exception
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||