documentation/manual/working/scalaGuide/main/config/ScalaConfig.md
Play uses the Typesafe config library, but Play also provides a nice Scala wrapper called Configuration with more advanced Scala features. If you're not familiar with Typesafe config, you may also want to read the documentation on [[configuration file syntax and features|ConfigFile]].
Typically, you'll obtain a Configuration object through [[Dependency Injection|ScalaDependencyInjection]], or simply by passing an instance of Configuration to your component:
The get method is the most common one you'll use. This is used to get a single value at a path in the configuration file.
It accepts an implicit ConfigLoader, but for most common types like String, Int, and even Seq[String], there are already loaders defined that do what you'd expect.
Configuration also supports validating against a set of valid values:
By defining your own ConfigLoader, you can easily convert configuration into a custom type. This is used extensively in Play internally, and is a great way to bring more type safety to your use of configuration. For example:
Then you can use config.get as we did above:
Play's Configuration supports getting optional configuration keys using the getOptional[A] method. It works just like get[A] but will return None if the key does not exist. Instead of using this method, we recommend setting optional keys to null in your configuration file and using get[Option[A]]. But we provide this method for convenience in case you need to interface with libraries that use configuration in a non-standard way.