(Quick Reference)



The bootstrap command is mainly intended to be used by other scripts and enables the ability to bootstrap a Grails application instance outside of the container for usage in tools that require a reference to Grails' ApplicationContext.

Examples of its usage include Grails' shell and console


Add this to the top of your Gant script to use this as an include:

includeTargets << grailsScript("_GrailsBootstrap")

Once this is in place you can bootstrap Grails using either of these methods:

  • loadApp - Loads and creates the GrailsApplication instance
  • configureApp - Loads all plugins and creates the Spring ApplicationContext

After running loadApp the GrailsApplication instance will be available as the grailsApp variable:

for (grailsClass in grailsApp.allClasses) { println grailsClass }

After running configureApp the GrailsPluginManager instance will be available as the pluginManager variable and the Spring ApplicationContext instance will be available as the appCtx variable:

Connection c = appCtx.getBean('dataSource').getConnection()
// do something with connection



grails bootstrap