Reading Configuration in Play (2.6.5) with Scala w

2020-06-25 04:17发布

I'm using Play 2.6.5 with Scala. Most of the times reading from the configuration works with injecting the configuration.

In some parts it would be too difficult to get a class into injection scope.

Is there a way to get the configuration object without injection?

1条回答
孤傲高冷的网名
2楼-- · 2020-06-25 04:56

You can use ConfigFactory ->

ConfigFactory.load().getString("db.url")

import for the same ->

import com.typesafe.config.ConfigFactory
查看更多
登录 后发表回答