KingOfCoders
KingOfCoders

Reputation: 2282

Reading Configuration in Play (2.6.5) with Scala without @Inject

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?

Upvotes: 3

Views: 588

Answers (1)

geek94
geek94

Reputation: 473

You can use ConfigFactory ->

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

import for the same ->

import com.typesafe.config.ConfigFactory

Upvotes: 6

Related Questions