Details
Description
In my test suites, I refer to many configuration variables, and find I cannot run my tests at the moment
ConfigurationHolder.config seems to be null, causing an NPE when I try to access my config settings
import org.codehaus.groovy.grails.commons.ConfigurationHolder class HelloControllerTests extends GroovyTestCase { void testReadingConfig() { println ConfigurationHolder.config.configtest.sayhello } }
"Error Cannot get property 'configtest' on null object
java.lang.NullPointerException: Cannot get property 'configtest' on null object
at HelloControllerTests.testReadingConfig(HelloControllerTests.groovy:6)
at _GrailsTest_groovy$_run_closure7_closure22_closure23_closure24.doCall(_GrailsTest_groovy:229)
at _GrailsTest_groovy$_run_closure7_closure22_closure23_closure24.doCall(_GrailsTest_groovy)
at _GrailsTest_groovy$_run_closure8_closure30.doCall(_GrailsTest_groovy:297)
at _GrailsTest_groovy$_run_closure8_closure30.call(_GrailsTest_groovy)
"
Putting the same code in a controller has no such problem
import org.codehaus.groovy.grails.commons.ConfigurationHolder
class HelloController {
def index = {
render ConfigurationHolder.config.configtest.sayhello
}
}
Forgot to mention that this code works perfectly in Grails 1.0.4