Externalizing properties of an application has really come a long way, especially if you are using Grails.
Just want to share as a quick tip how easy it is to externalize the properties in a Grails application.
This is what all we have to do in-order to get something from a properties file.
In config.groovy include the properties that you want to be outside your groovy code.
For Example :
smtpUserName = "<email@example.com>"
hostname = "yourHostName"
In order to read these properties in your Grails controller:
def smtpUserName = grailsApplication.config.smtpUserName
In order to read the properties from Grails Service class:
def smtpUserName = ConfigurationHolder.config.smtpUserName
Easy, isn’t it?