Merge pull request #2864 from FOCONIS/feature/override-service-objects

NEW: Override service objects with DatabaseConfig.putServiceObject
This commit is contained in:
Rob Bygrave
2022-11-10 13:05:22 +13:00
committed by GitHub
6 changed files with 87 additions and 7 deletions
@@ -615,7 +615,7 @@ public class DatabaseConfig {
}
/**
* Put a service object into configuration such that it can be passed to a plugin.
* Put a service object into configuration such that it can be used by ebean or a plugin.
* <p>
* For example, put IgniteConfiguration in to be passed to the Ignite plugin.
*/
@@ -623,6 +623,28 @@ public class DatabaseConfig {
serviceObject.put(key, configObject);
}
/**
* Put a service object into configuration such that it can be used by ebean or a plugin.
* <p>
* For example, put IgniteConfiguration in to be passed to the Ignite plugin.
* You can also override some SPI objects that should be used for that Database. Currently, the following
* objects are possible.
* <ul>
* <li>DataSourceAlertFactory (e.g. add different alert factories for different ebean instances)</li>
* <li>DocStoreFactory</li>
* <li>XmapService</li>
* <li>SpiLoggerFactory (e.g. add custom logger for a certain ebean instance)</li>
* <li>AutoTuneServiceProvider</li>
* <li>SpiProfileHandler</li>
* <li>SlowQueryListener (e.g. add custom query listener for a certain ebean instance)</li>
* <li>ServerCacheNotifyPlugin</li>
* <li>SpiDdlGenneratorProvider</li>
* </ul>
*/
public <T> void putServiceObject(Class<T> iface, T configObject) {
serviceObject.put(serviceObjectKey(iface), configObject);
}
/**
* Return the service object given the key.
*/
@@ -631,7 +653,7 @@ public class DatabaseConfig {
}
/**
* Put a service object into configuration such that it can be passed to a plugin.
* Put a service object into configuration such that it can be used by ebean or a plugin.
*
* <pre>{@code
*
@@ -656,7 +678,7 @@ public class DatabaseConfig {
}
/**
* Used by plugins to obtain service objects.
* Used by ebean or plugins to obtain service objects.
*
* <pre>{@code
*