PLay 2.6:配置中的Config.path的等价API。

问题描述 投票:0回答:1

我现在使用play 2.6,从play 2.4迁移过来的,在play 2.4中,我使用的是Configuration.path().getAbsolutePath();根据play 2.6的文档,Configuration被替换为com.typesafe.config.Config;但我在这里没有看到任何等价的path()api。

任何帮助。

谢谢你的帮助

playframework
1个回答
0
投票

你需要注入环境类。

private final Environment environment;

@Inject
public YourConstructor(Environment environment)
    this.environment = environment;
}

现在来获取根路径。

environment.rootPath();
最新问题
© www.soinside.com 2019 - 2024. All rights reserved.