mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
#285 - ENH: support disable search classes config via ServerConfig.setDisableClasspathSearch(true)
This commit is contained in:
@@ -85,6 +85,11 @@ public class ServerConfig {
|
||||
*/
|
||||
private boolean defaultServer;
|
||||
|
||||
/**
|
||||
* Set this to true to disable class path search.
|
||||
*/
|
||||
private boolean disableClasspathSearch;
|
||||
|
||||
/**
|
||||
* List of interesting classes such as entities, embedded, ScalarTypes,
|
||||
* Listeners, Finders, Controllers etc.
|
||||
@@ -1247,6 +1252,22 @@ public class ServerConfig {
|
||||
return ddlRun;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if the class path search should be disabled.
|
||||
*/
|
||||
public boolean isDisableClasspathSearch() {
|
||||
return disableClasspathSearch;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set to true to disable the class path search even for the case where no entity bean classes
|
||||
* have been registered. This can be used to start an EbeanServer instance just to use the
|
||||
* SQL functions such as SqlQuery, SqlUpdate etc.
|
||||
*/
|
||||
public void setDisableClasspathSearch(boolean disableClasspathSearch) {
|
||||
this.disableClasspathSearch = disableClasspathSearch;
|
||||
}
|
||||
|
||||
/**
|
||||
* Programmatically add classes (typically entities) that this server should
|
||||
* use.
|
||||
@@ -1714,6 +1735,7 @@ public class ServerConfig {
|
||||
autoCommitMode = p.getBoolean("autoCommitMode", autoCommitMode);
|
||||
useJtaTransactionManager = p.getBoolean("useJtaTransactionManager", useJtaTransactionManager);
|
||||
|
||||
disableClasspathSearch = p.getBoolean("disableClasspathSearch", disableClasspathSearch);
|
||||
databasePlatform = createInstance(p, DatabasePlatform.class, "databasePlatform");
|
||||
encryptKeyManager = createInstance(p, EncryptKeyManager.class, "encryptKeyManager");
|
||||
encryptDeployManager = createInstance(p, EncryptDeployManager.class, "encryptDeployManager");
|
||||
|
||||
@@ -249,7 +249,7 @@ public class DefaultContainer implements SpiContainer {
|
||||
private BootupClasses getBootupClasses1(ServerConfig serverConfig) {
|
||||
|
||||
List<Class<?>> entityClasses = serverConfig.getClasses();
|
||||
if (entityClasses != null && entityClasses.size() > 0) {
|
||||
if (serverConfig.isDisableClasspathSearch() || (entityClasses != null && entityClasses.size() > 0)) {
|
||||
// use classes we explicitly added via configuration
|
||||
return new BootupClasses(serverConfig.getClasses());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user