From 36c6f650d69d3912606d63672fd82d5c17bf0b15 Mon Sep 17 00:00:00 2001 From: LeComptoirDesPharmacies Date: Tue, 25 May 2021 21:58:35 +0200 Subject: [PATCH] Fix PlayEbean configuration loading for sub projects (#209) (#210) --- .../main/java/play/db/ebean/ModelsConfigLoader.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/play-ebean/src/main/java/play/db/ebean/ModelsConfigLoader.java b/play-ebean/src/main/java/play/db/ebean/ModelsConfigLoader.java index 356752b2..2d56cb33 100644 --- a/play-ebean/src/main/java/play/db/ebean/ModelsConfigLoader.java +++ b/play-ebean/src/main/java/play/db/ebean/ModelsConfigLoader.java @@ -4,10 +4,9 @@ package play.db.ebean; -import com.typesafe.config.Config; -import com.typesafe.config.ConfigFactory; -import play.Environment; import play.Mode; +import play.api.Environment; +import play.api.Configuration; import java.io.File; import java.util.List; @@ -24,8 +23,8 @@ public class ModelsConfigLoader implements Function> apply(ClassLoader classLoader) { // Using TEST mode is the only way to load configuration without failing if application.conf doesn't exist - Environment env = new Environment(new File("."), classLoader, Mode.TEST); - Config config = ConfigFactory.load(env.classLoader()); - return EbeanParsedConfig.parseFromConfig(config).getDatasourceModels(); + Environment env = new Environment(new File("."), classLoader, Mode.TEST.asScala()); + Configuration config = Configuration.load(env); + return EbeanParsedConfig.parseFromConfig(config.underlying()).getDatasourceModels(); } }