Grails:在BootStrap.groovy中获取上下文路径

dea*_*mon 1 java grails servlets

如何在Grails应用程序的BootStrap.groovy文件中获取上下文路径?

tim*_*tes 6

你不能这样做:

class BootStrap {
  def init = { servletContext ->
    println "$servletContext.contextPath"
  }
  def destroy = {
  }
}
Run Code Online (Sandbox Code Playgroud)