How to map values from app.config to scala object and used it

(Jw44250) #1

how to map scala object with application.conf properties and reading controllers

app.conf has follow propertiest:

emp {
name: “sam”,
salary: 200
}

case class Emp(name:String, salary:Double)

(Greg Methvin) #2

What you need is basically a macro to read the config properties based on the fields in the case class. There are a few libraries out there that provide this functionality, for example:


If you’re looking for something very minimal on top of Play, I wrote https://github.com/gmethvin/play-autoconfig, but the features of the above two libraries are far more extensive.