title: NullpointerException: cannot get property on null object
body: <p>Working on IDEA and trying to launch the following code:</p>
  <pre><code>package com.myCompany.routing.spring
  
  import com.dropbox.core.DbxRequestConfig
  import grails.util.Holders
  import spock.lang.Specification
  
  class DropboxSpringConfigSpec extends Specification {
      def grailsApplication=Holders.grailsApplication
  
      def &quot;It instantiates and configures the dropboxRequestConfig component&quot;() {
          given:
          def ctx = grailsApplication.mainContext
          //do stuff...
      }
  }
  </code></pre>
  <p>I get the following error:</p>
  <blockquote>
  <p>java.lang.NullPointerException: Cannot get property 'mainContext' on null object</p>
  <p>at com.myCompany.routing.spring.DropboxSpringConfigSpec.It instantiates and configures the dropboxRequestConfig component(DropboxSpringConfigSpec.groovy:20)</p>
  </blockquote>
  <p>I've recently made a pull on my VCS, so the code should work.</p>
  <p>When running the test as Grails test, I get the following error:</p>
  <blockquote>
  <p>Error |
  2015-03-04 13:32:00,989 [localhost-startStop-1] ERROR context.GrailsContextLoader  - Error initializing the application:
  Missing configuration in Config.groovy: connection.uri.</p>
  </blockquote>