ca.grimoire.mainspring
Class Bootstrap

java.lang.Object
  extended by ca.grimoire.mainspring.Bootstrap

public class Bootstrap
extends Object

Bootstraps a Spring context XML file. The context configuration can either be loaded from a classpath resource using a ClassPathXmlApplicationContext, which happens if no command-line arguments are provided, or using a FileSystemXmlApplicationContext, which happens if any command-line arguments are provided. The context is created, its shutdown hook is registered, and then the thread that loaded the context terminates.

To do something useful with this class, create a context containing at least one non-lazy singleton-scoped bean definition with an init-method specified.

This class can be specified as the Main-Class of a JAR file. This allows for JARs containing a "META-INF/mainspring.xml" resource to be relatively self-contained; the JAR containing this class must be mentioned in the Class-Path, either directly or indirectly, along with the JARs for any Spring components used in the bootstrap context.

Do not use this class directly if your Spring application context contains Swing components. The bootstrap process runs on the thread that calls main(String[]). See Swingstrap for a Swing-safe way to launch Swing contexts.


Field Summary
static String DEFAULT_CONTEXT
          The name of the Spring context XML file loaded by default.
 
Constructor Summary
Bootstrap()
           
 
Method Summary
static void main(String[] args)
          Runs the bootstrap process.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_CONTEXT

public static final String DEFAULT_CONTEXT
The name of the Spring context XML file loaded by default.

See Also:
Constant Field Values
Constructor Detail

Bootstrap

public Bootstrap()
Method Detail

main

public static void main(String[] args)
Runs the bootstrap process. If no arguments are provided, the bootstrap configuration is loaded from "META-INF/mainspring.xml" as a resource. All arguments are treated as alternate context configuration files and are loaded instead of the default context.

Parameters:
args - the names of the contexts to load. If empty or null, the default context will be loaded instead.


Copyright © 2008 Grimoire Alchymia. All Rights Reserved.