Getting hold of ApplicationContext
and grailsApplication
is possible though bootstrap
command. Include _GrailsBootstrap
script, then call configureApp ()
or depend on it in order to make ApplicationContext
available in script:
includeTargets << grailsScript("_GrailsInit")
includeTargets << grailsScript("_GrailsBootstrap")
target(loadGames: "The description of the script goes here!") {
depends(configureApp)
def listFile = new File('list.txt')
listFile.eachLine {
//Once configureApp() called ApplicationContext can be accessed as appCtx
def result = appCtx.getBean("bggService").search(it)
println it + " " + result.length()
}
}
setDefaultTarget(loadGames)