in earlier versions read with a bang
val value = Play.current.configuration.getString("confKey") but play 2.5 issues a warning
This is a static reference to an application, use DI instead.
which means - guys use Dependency Injection
Well, I write the following code:
import javax.inject.Inject import play.api.Configuration class SomeClass @Inject() (playconfiguration: Configuration) { val someConfigValue: String = playconfiguration.getString("someConfKey").get } Need access to config из объекта . Ok, we inherit the class and give it the configuration, then I have a problem, I do not understand where to get it
object SomeObj extends SomeClass(Configuration.и что дальше?`){ def getSomeConfigValue(): String = someConfigValue } reading from both application.conf and somePath/someFile.conf
In the end, the question can be reformulated - " how to read the key value from application.conf or * .conf in an object, bypassing the warning about DI, that is, not using Play.current.configuration but using Dependency Injection ? "
object AnyObj { val value = читаем из конфигурационного файла } Help me to understand.