scalatypesafe-config

No configuration setting found for key typesafe config


Im trying to implement a configuration tool typesafehub/config im using this code

 val conf = ConfigFactory.load()
 val url = conf.getString("add.prefix") + id + "/?" + conf.getString("add.token")

And the location of the property file is /src/main/resources/application.conf

But for some reason i'm receiving

com.typesafe.config.ConfigException$Missing: No configuration setting found for key 'add'

File content

add {
  token = "access_token=6235uhC9kG05ulDtG8DJDA"
  prefix = "https://graph.facebook.com/v2.2/"
  limit = "&limit=250"
  comments="?pretty=0&limit=250&access_token=69kG05ulDtG8DJDA&filter=stream"
  feed="/feed?limit=200&access_token=623501EuhC9kG05ulDtG8DJDA&pretty=0"
}

Everything looks configured correctly ?? do i missed something .

thanks,

miki


Solution

  • The error message is telling you that whatever configuration got read, it didn't include a top level setting named add. The ConfigFactory.load function will attempt to load the configuration from a variety of places. By default it will look for a file named application with a suffix of .conf or .json. It looks for that file as a Java resource on your class path. However, various system properties will override this default behavior.

    So, it is likely that what you missed is one of these: