Custom Class Loader

In certain environments or setups it is necessary to provide specific ClassLoader instances. This can be done by customizing the connection foundation.

If a single ClassLoader is sufficient, just create a new provider by handing over the instance:

EmbeddedStorageFoundation<?> foundation = EmbeddedStorage.Foundation();
foundation.getConnectionFoundation().setClassLoaderProvider(
ClassLoaderProvider.New(myClassLoader)
);
EmbeddedStorageManager storage = foundation.start();

Or return a ClassLoader depending on the requested type:

EmbeddedStorageFoundation<?> foundation = EmbeddedStorage.Foundation();
foundation.getConnectionFoundation().setClassLoaderProvider(
typeName -> {
if(typeName.startsWith("com.company.module1."))
{
return module1ClassLoader;
}
if(typeName.startsWith("com.company.module2."))
{
return module2ClassLoader;
}
return ClassLoader.getSystemClassLoader();
}
);
EmbeddedStorageManager storage = foundation.start();