Last updated by BrandonFranklin 8 years ago

Configuring Start-up

Programmatic start-up configuration can be added to a Grails application by creating one or many "BootStrap" classes in the "%PROJECT_HOME%/grails-app/conf" directory:

class ExampleBootStrap {

def init = { servletContext -> // init app } def destroy = { // destroy app } }

The "init" closure (if it exists) is called on application load and the "destroy" closure (again if it exists) on application exit
It is not guaranteed that {{destroy}} will be called unless the application exits gracefully (for example by using the application server's shutdown command) so don't rely on it too much
See the Quick Start page for an example of using the "init" closure to build and save domain objects.