Service Grails2.1.0未将grailsApplication注入服务

Service Grails2.1.0未将grailsApplication注入服务,service,configuration,code-injection,grails-2.1,Service,Configuration,Code Injection,Grails 2.1,我有一个从grailsApplication访问一些配置属性的服务 我是这样注射的 class MyWebService{ def grailsApplication WebService webService = new WebService() def getProxy(url, flag){ return webService.getClient(url) } def getResponse(){

我有一个从grailsApplication访问一些配置属性的服务

我是这样注射的

    class MyWebService{
       def grailsApplication
       WebService webService = new WebService()

       def getProxy(url, flag){
        return webService.getClient(url)
      }

    def getResponse(){
     def proxy =  getProxy(grailsApplication.config.grails.wsdlURL, true)
     def response = proxy.getItem(ItemType)
     return response
   }
}
当我调用getProxy()方法时,我在tomcat日志中看到了这一点

方法org.example.MyWebService.getProxy()的签名不适用于参数类型:(groovy.util.ConfigObject,java.lang.Boolean)值:[[:],true] 可能的解决方案:getProxy()、getProxy(java.lang.String、boolean)、setProxy(java.lang.Object)

这意味着grailsApplication没有被注入到服务中,是否有其他方法可以访问配置对象?根据burtbeckwith的post configurationholder已被弃用,想不出其他任何东西


有趣的是,同样的服务在我的本地IDE(GGTS 3.1.0)中运行良好,这意味着本地grailsApplication正在被注入,但当我创建一个war部署到一个独立的tomcat时,它停止了注入。

我似乎已经解决了问题,实际上grailsApplication被正确地注入了,否则它会抛出一个空指针异常,我觉得配置属性没有被添加。实际上,该场景类似于,我有一个单独的自定义配置文件,该文件保存不同环境的配置数据,我的应用程序侦听Environment类型(一个从tomcat设置的变量),并基于该类型从自定义配置文件合并相应的配置属性。我认为这些提议可能没有得到增加

我认为没有理由投反对票,要么你知道太多圣杯,要么你根本不知道