Accessing appName property from controller in Grails

It is trivial to access the appName property from within the config.groovy file, and it is a common practice to do so. Here is an example of specifying an external config file based on the name of the grails application:

grails.config.locations = ["file:$userHome/.osaas/$appName.groovy"


I could find no where obvious that described how to access this appName property from a constructor. You would expect the following to work but it does not:

grailsApplication.config.appName


The following does work however

grailsApplication.metadata['app.name']

Comments

  1. Thanks a lot... :) I have been searching a lot to figure this out!

    ReplyDelete

Post a Comment

Popular posts from this blog

AngularJs: User friendly date display with AngularJs and MomentJs

Getting started with Grails functional tests using Geb + Spock

Nerd Tree: A File Explorer with Mac Vim