Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reloading bootstrap with Grails

Tags:

grails

Is there a way in Grails to run the contents of BootStrap.groovy after it has been changed without restarting the app?

like image 388
Odinodin Avatar asked May 03 '12 21:05

Odinodin


1 Answers

You can do this with the console plugin. I'd highly recommend this plugin for any development environment because it's so useful for running ad-hoc code inside a running server.

To rerun your BootStrap init closure, browse to the web-based console at http://localhost:8080/appname/console. Enter the following in the console:

def servletCtx = org.codehaus.groovy.grails.web.context.ServletContextHolder.servletContext
def myBootstrapArtefact = grailsApplication.getArtefacts('Bootstrap')[-1]
myBootstrapArtefact.referenceInstance.init(servletCtx)
like image 174
ataylor Avatar answered Oct 11 '22 02:10

ataylor