Pergunta

I have service in which i am accessing few configuration properties from grailsApplication

I am injecting it like this

    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
   }
}

When i call getProxy() method, i see this in tomcat logs

No signature of method: org.example.MyWebService.getProxy() is applicable for argument types: (groovy.util.ConfigObject, java.lang.Boolean) values: [[:], true] Possible solutions: getProxy(), getProxy(java.lang.String, boolean), setProxy(java.lang.Object)

which means grailsApplication is not getting injected into the service, is there any alternate way to access configuration object ? according to burtbeckwith's post configurationholder has been deprecated, can't think of anything else.

Interestingly the very same service works fine in my local IDE(GGTS 3.1.0), that means locally grailsApplication is getting injected, but when i create a war to deploy to a standalone tomcat, it stops getting injected.

Foi útil?

Solução

I seem to have figured out the problem, actually grailsApplication is getting injected properly otherwise it would have thrown a null pointer exception, i feel the configuration properties are not getting added. Actually the scenario is like, i have a separate custom configuration file which holds configuration data for different environments, my application listens to the environement type(a variable which is set from tomcat) and based on that merges the corresponding config properties from my custom configuration file. i think those propreties are probably not getting added

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top