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

前端 未结 13 2139
一整个雨季
一整个雨季 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条回答
  •  -上瘾入骨i
    2020-12-24 10:57

    In Play 1.2.x

    import play.Play;
    ...
    
    
    String version  = Play.configuration.getProperty("application.version.number", "1.1.1");
    

    where the second parameter is the default value

提交回复
热议问题