在静态方法中调用 grailsApplication
Calling grailsApplication inside a static method
在我的 class 我已经定义了,
def grailsApplication;
现在在静态方法中尝试访问它,但出现错误:
Groovy:Apparent variable 'grailsApplication' was found in a static scope but doesn't refer to a local variable, static field or class. Possible causes:
如何在静态方法中访问 grailsApplication?
将其作为方法参数传递:
static someMethod( grailsApplication ){...}
Grails 开发人员不鼓励使用静态技巧来访问应用程序上下文
在我的 class 我已经定义了,
def grailsApplication;
现在在静态方法中尝试访问它,但出现错误:
Groovy:Apparent variable 'grailsApplication' was found in a static scope but doesn't refer to a local variable, static field or class. Possible causes:
如何在静态方法中访问 grailsApplication?
将其作为方法参数传递:
static someMethod( grailsApplication ){...}
Grails 开发人员不鼓励使用静态技巧来访问应用程序上下文