Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package ca.grimoire.mainspring;
Bootstraps a Spring context XML file. The context configuration can either be loaded from a classpath resource using a, which happens if no command-line arguments are provided, or using a, 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 DEFAULT_CONTEXT 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(java.lang.String[]). See Swingstrap for a Swing-safe way to launch Swing contexts.

public class Bootstrap {
The name of the Spring context XML file loaded by default.
	public static final String DEFAULT_CONTEXT = "META-INF/mainspring.xml";

Runs the bootstrap process. If no arguments are provided, the bootstrap configuration is loaded from DEFAULT_CONTEXT as a resource. All arguments are treated as alternate context configuration files and are loaded instead of the default context.

args the names of the contexts to load. If empty or null, the default context will be loaded instead.
	public static void main(String[] args) {
		if (args != null && args.length > 0)
			return createArgumentContext(args);
			String[] args) {
		return context;
		return context;
New to GrepCode? Check out our FAQ X