title: Grails: Utility class for tests that needs handle to grailsApplication.config
body: <p>I have a bunch of integration tests.  I want a class that has some utility methods that the tests use.  I started off making the utility methods all static and it was easy to get a handle to them from the tests. </p>
  
  <p>However, I needed the utility class to be able to get a handle on the grailsApplication.confg so I could pull in some config.  To do this, because the utility class is not a service, I made the class implement <code>ApplicationContextAware</code>.  This meant I had to make the static methods instance based.  Fair enough.</p>
  
  <p>To make it ApplicationContextAware, I implement interface and I do:</p>
  
  <pre><code>class TestUtils {
      def grailsApplication
      @Override
      public void setApplicationContext(ApplicationContext applicationContext)
          throws BeansException {
             // TODO Auto-generated method stub
            this.grailsApplication = grailsApplication
      }
      ...
  </code></pre>
  
  <p>But this never gets called meaning my local grailApplication ref is never set.</p>
  
  <p>Is it better if I just made this TestUtility field a service or what are my doing wrong?</p>