【发布时间】:2020-05-17 18:26:06
【问题描述】:
我现在使用的是从 Play 2.4 迁移而来的 play 2.6。 在播放 2.4 中,我使用的是 Configuration.path().getAbsolutePath(); 根据 play 2.6 文档,配置被替换为 com.typesafe.config.Config; 但我在这里没有看到任何等效的 path() api。
任何帮助。
谢谢
【问题讨论】:
标签: playframework
我现在使用的是从 Play 2.4 迁移而来的 play 2.6。 在播放 2.4 中,我使用的是 Configuration.path().getAbsolutePath(); 根据 play 2.6 文档,配置被替换为 com.typesafe.config.Config; 但我在这里没有看到任何等效的 path() api。
任何帮助。
谢谢
【问题讨论】:
标签: playframework
您需要注入 Environment 类。
private final Environment environment;
@Inject
public YourConstructor(Environment environment)
this.environment = environment;
}
现在获取根路径:
environment.rootPath();
【讨论】: