Pimp my Grails Bootstrap
Posted by admin - 11/05/09 at 10:05:14 amIf you want to depend data loaded in bootstrap from environment that application is currently running in, try this solution:
import grails.util.GrailsUtil import org.codehaus.groovy.grails.commons.GrailsApplication class BootStrap { def init = { servletContext -> if(!envMapping[GrailsUtil.environment]){ return } envMapping[GrailsUtil.environment]() } def destroy = { } def initTest = { ... } def initDev = { ... } def initProd = { ... } def envMapping = [(GrailsApplication.ENV_TEST):initTest, (GrailsApplication.ENV_DEVELOPMENT):initDev, (GrailsApplication.ENV_PRODUCTION):initProd] }
Variable envMapping is on the end BootStrap class becouse in other case values in map were set as null (???).
May 11, 2009 | In Grails | No Comments
Powered by WordPress with GimpStyle Theme design by Horacio Bella.
Entries and comments feeds.
Valid XHTML and CSS.