Accessing the application.conf properties from java class with Play! 2.0

前端 未结 13 2063
一整个雨季
一整个雨季 2020-12-24 10:37

I want to add an object to the Global scope, and in order to construct it I need to pass it a path to a file. I don\'t want to hard code the file path in the source, and so

相关标签:
13条回答
  • 2020-12-24 11:12

    As folks have mentioned, Play.application.configuration no longer exists.

    In Play Scala 2.3.x, to read a value from conf/application.conf, you can do the following:

    import play.api.Play.current
    ...
    current.configuration.getString("key")
    
    0 讨论(0)
提交回复
热议问题