#1555 - Support .yaml extension (in addition to the existing .yml extension) for application.yaml and application-test.yaml

This commit is contained in:
rob bygrave
2018-11-20 11:45:45 +13:00
parent 426c6c8111
commit ecf5b56652
5 changed files with 8 additions and 6 deletions
+2 -2
View File
@@ -4,10 +4,10 @@ import io.ebean.annotation.TxIsolation;
import io.ebean.cache.ServerCacheManager;
import io.ebean.config.BeanNotEnhancedException;
import io.ebean.config.ServerConfig;
import io.ebean.datasource.DataSourceConfigurationException;
import io.ebean.plugin.Property;
import io.ebean.text.csv.CsvReader;
import io.ebean.text.json.JsonContext;
import io.ebean.datasource.DataSourceConfigurationException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -167,7 +167,7 @@ public final class Ebean {
} catch (DataSourceConfigurationException e) {
String msg = "Configuration error creating DataSource for the default EbeanServer." +
" This typically means a missing application-test.yml or missing ebean-test-config dependency." +
" This typically means a missing application-test.yaml or missing ebean-test-config dependency." +
" See https://ebean.io/docs/trouble-shooting#datasource";
throw new DataSourceConfigurationException(msg, e);
@@ -63,6 +63,7 @@ class Loader {
*/
private void loadTest() {
loadProperties("application-test.properties", Source.RESOURCE);
loadYaml("application-test.yaml", Source.RESOURCE);
loadYaml("application-test.yml", Source.RESOURCE);
loadProperties("test-ebean.properties", Source.RESOURCE);
}
@@ -83,6 +84,7 @@ class Loader {
* Load the main configuration for the given source.
*/
private void loadMain(Source source) {
loadYaml("application.yaml", source);
loadYaml("application.yml", source);
loadProperties("application.properties", source);
loadProperties("ebean.properties", source);
@@ -18,14 +18,14 @@ public class PropertiesLoader {
* <p>Firstly loads from main resources</p>
* <pre>
* - application.properties
* - application.yml
* - application.yaml
* - ebean.properties
* </pre>
* <p>
* <p>Then loads from local files</p>
* <pre>
* - application.properties
* - application.yml
* - application.yaml
* - ebean.properties
* </pre>
* <p>
@@ -41,7 +41,7 @@ public class PropertiesLoader {
* <p>Loads from test resources</p>
* <pre>
* - application-test.properties
* - application-test.yml
* - application-test.yaml
* - test-ebean.properties
* </pre>
*/
@@ -17,7 +17,7 @@ public class LoaderTest {
Loader loader = new Loader();
loader.loadProperties("test-properties/application.properties", Loader.Source.RESOURCE);
loader.loadYaml("test-properties/application.yml", Loader.Source.RESOURCE);
loader.loadYaml("test-properties/application.yaml", Loader.Source.RESOURCE);
loader.loadProperties("test-properties/one.properties", Loader.Source.RESOURCE);
loader.loadYaml("test-properties/foo.yml", Loader.Source.RESOURCE);