玩法 2.6:Config 中 Configuration.path 的等价物 API

PLay 2.6: Equivalent API of Configuration.path in Config

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

任何帮助。

谢谢

您需要注入环境class。

private final Environment environment;

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

现在获取根路径:

environment.rootPath();