mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
#1343 - Update the #1283 ENH: Support simplified test configuration (with docker setup typically via application-test.yml)
This commit is contained in:
@@ -6,10 +6,13 @@ package io.ebean.config;
|
||||
public interface AutoConfigure {
|
||||
|
||||
/**
|
||||
* Provide some configuration the ServerConfig prior to server creation.
|
||||
* <p>
|
||||
* Return true if the autoConfiguration applies to this ServerConfig.
|
||||
* Perform configuration for the ServerConfig prior to properties load.
|
||||
*/
|
||||
void configure(ServerConfig serverConfig);
|
||||
void preConfigure(ServerConfig serverConfig);
|
||||
|
||||
/**
|
||||
* Provide some configuration the ServerConfig prior to server creation but after properties have been applied.
|
||||
*/
|
||||
void postConfigure(ServerConfig serverConfig);
|
||||
|
||||
}
|
||||
|
||||
@@ -2650,19 +2650,24 @@ public class ServerConfig {
|
||||
* Load the settings from the given properties
|
||||
*/
|
||||
private void configureFromProperties() {
|
||||
autoConfiguration();
|
||||
PropertiesWrapper p = new PropertiesWrapper("ebean", name, properties, classLoadConfig);
|
||||
loadSettings(p);
|
||||
List<AutoConfigure> autoConfigures = autoConfiguration();
|
||||
loadSettings(new PropertiesWrapper("ebean", name, properties, classLoadConfig));
|
||||
for (AutoConfigure autoConfigure : autoConfigures) {
|
||||
autoConfigure.postConfigure(this);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Use a 'plugin' to provide automatic configuration. Intended for automatic testing
|
||||
* configuration with Docker containers via ebean-test-config.
|
||||
*/
|
||||
private void autoConfiguration() {
|
||||
private List<AutoConfigure> autoConfiguration() {
|
||||
List<AutoConfigure> list = new ArrayList<>();
|
||||
for (AutoConfigure autoConfigure : serviceLoad(AutoConfigure.class)) {
|
||||
autoConfigure.configure(this);
|
||||
autoConfigure.preConfigure(this);
|
||||
list.add(autoConfigure);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user