Blog, Software Engineering

Deprecation of ConfigurationHolder in Grails 2

While porting my Grails applications to 2.0 RC1, I recognized that ConfigurationHolder is now deprecated. The new way to access the configuration is through dependency injection of the grailsApplication bean.

Before 2.0:

import org.codehaus.groovy.grails.commons.ConfigurationHolder as CH
...
def value = CH.config.my.configEntry

With 2.0:

class MyService/MyController {
	def grailsApplication
	def method {
		def value = grailsApplication.config.my.configEntry
	}
}

1 Comment

Comments are closed.