grails async bootstrap
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Is it possible to use a service asynchronously in the grails bootstrap class? I am trying to do the following in grails-2.0.4 and the grails-executor-plugin, but only the first log message appears: class BootStrap { def myService def init = { servletContext -> log.info("Bootstrapping") runAsync { log.info("Doing myService async ") myService.doSomething() } } There is no error message, just no output from the second log statement. Thanks a lot in advance! 回答1: Remove runAsync closure - it is not the right place for it. You can use closures