Change default config file in grails

03 / Jun / 2015 by neetu.nandwani 0 comments

I was going through Grails documentation and found one interesting fact that I would like to share. As we already know that grails configuration can be externalised using

[code]

grails.config.locations = [‘path to external config file’]

[/code]

Any config defined in this external config will override the value defined in Config.groovy.

It might be possible that we want to have default value fetched from some other config files which can be overridden in Config.groovy, In that case add this property to Config.groovy

[code]

grails.config.defaults.locations = [‘path to your external/default config file’]

[/code]

The config described by grails.config.defaults.locations will be loaded before all other values and can therefore be overridden.

Here is the link to documentation.

FOUND THIS USEFUL? SHARE IT

Leave a Reply

Your email address will not be published. Required fields are marked *