有没有办法尽早获得配置(在调用com.typesafe.config.Config.resolve()之前)?我想在遇到未解决的替换时提供自定义行为 在解决期间(link to feature in typesafe config)
我正在使用Play 2.6.x
感谢您的帮助。
答案 0 :(得分:2)
目前Play中没有地方可以提前访问配置。配置由String[] locales = Locale.getISOCountries();
List<String> countries = new ArrayList<>();
countries.add("**Select Country**");
for (String countryCode : locales) {
Locale obj = new Locale("", countryCode);
countries.add(obj.getDisplayCountry());
}
Collections.sort(countries);
countrySpinner.setItems(countries);
/ DevServerStart
使用硬编码加载逻辑加载,并传递给ProdServerStart
和ServerProvider
。
ApplicationLoader
(Java,Scala)确实能够重写配置,如果适合您的话。
我们可以添加对自定义ApplicationLoader
的支持,作为Play中的新功能。它可能必须从系统属性驱动才能找到正确的类。如果您喜欢此功能,请create an issue。