In case you have a need for inline statements to execute in Grails based upon the environment setting, you can do it like this:

In your class/service, you import:

import grails.util.Environment

Then in the class closure you can add:

Environment.executeForCurrentEnvironment {

  production {

    println "this is for production"

  }

  development {

    println "this is for development"

  }

}
#

Comments are closed

Archives
Categories