Play Framework 2.1: Use play.api.Configuration in Build.scala

↘锁芯ラ 提交于 2019-11-27 19:31:26
kapex

I works in 2.1-RC2 if you use typesafe's config library directly, without Play's Configuration wrapper. It's a Java API, so it is used slightly different than described in this answer.

In project/Build.scala import the library:

import com.typesafe.config._

and load the configuration from the file manually. Calling resolve() is needed to resolve substitutions.

val conf = ConfigFactory.parseFile(new File("conf/application.conf")).resolve()

val appName    = conf.getString("app.name")
val appVersion = conf.getString("app.version")
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!