title: How to properly inject service into groovy class?
body: <p>I'm using Grails 1.2.1.  I have a class in my src/groovy file in which I'd like to inject a reference to a service.  So I have ...</p>
  
  <pre><code>def utilityService
  
  public HttpTransporter(URI uri, HttpServletResponse response) { 
      this.uri = uri;
      this.response = response;
      def ctx = ApplicationHolder.getApplication().getMainContext();
      utilityService = ctx.getBean("utilityService");
  }   // HttpTransporter
  </code></pre>
  
  <p>But this seems very anti-Groovy/Grails.  Also, I don't like creating a new instance of the service upon every class instantiation.  Any ideas on how to optimize this?</p>
  
  <p>Thanks, - Dave</p>