Skip to content

Instantly share code, notes, and snippets.

@shubhra02
shubhra02 / PureConfig.scala
Last active June 16, 2017 11:09
Pure Config Code
import pureconfig.loadConfig
case class CompanyEmployee(companyName: String, place: String)
case class Employee(jobTitle: String, company: CompanyEmployee)
loadConfig[Employee](config, "se.pureconfig.example")
// res3: Either[pureconfig.error.ConfigReaderFailures,Employee] = Right(Employee(Software consultant,CompanyEmployee("Knoldus","Noida")))
@shubhra02
shubhra02 / TypeSafe.scala
Last active June 17, 2017 10:13
Type Safe Code
import com.typesafe.config._
case class Employee(config: Config) {
val jobTitle = config.getString("jobTitle")
object company {
val companyName = config.getString("company.companyName")
val place = config.getString("company.place")
}
}
@shubhra02
shubhra02 / TypeSafe
Created June 16, 2017 04:57
Typesafe code
import com.typesafe.config._
case class Employee(config: Config) {
val jobTitle = config.getString("jobTitle")
object company {
val companyName = config.getString("company.companyName")
val place = config.getString("company.place")
}
}