Quantcast

loading external BootStrap.groovy

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

loading external BootStrap.groovy

nreese
loading external BootStrap.groovy

Is it possible to load an external BootStrap.groovy file?  I know how to load external property files, but can not find any documentation on how to load an external BootStrap.groovy file.  I want to be able to externally initialize domain objects for many different production environments.

Thanks,

Nathan

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: loading external BootStrap.groovy

Ian Roberts
On 18/03/2011 21:18, Reese, Nathan wrote:
> Is it possible to load an external BootStrap.groovy file?  I know how to
> load external property files, but can not find any documentation on how
> to load an external BootStrap.groovy file.  I want to be able to
> externally initialize domain objects for many different production
> environments.

Not directly, but since you can have external .groovy *config* files the
easiest approach is to say something like this in BootStrap.groovy:

def extraBootStrap = grailsApplication.config.myapp.extraBootStrap
if(extraBootStrap) {
  extraBootStrap.call(servletContext)
}

Then in a grails.config.locations external .groovy config file you can say

myapp {
  extraBootStrap = { servletContext ->
    // put your bootstrap code here
  }
}

Ian

--
Ian Roberts               | Department of Computer Science
[hidden email]  | University of Sheffield, UK

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Loading...