Hello,
I am having difficulties migrating from Liquibase 3.6.3 to Liquibase 4.3.3
In my 3.6.3 implementation, I have the following piece of code to override my Resource Accessor.
public class MyCustomResourceAccessor implements ResourceAccessor {
private final ResourceAccessor inner;
public MyCustomResourceAccessor(ResourceAccessor... resourceAccessors) {
if (resourceAccessors.length == 1) {
this.inner = resourceAccessors[0];
} else {
this.inner = new CompositeResourceAccessor(resourceAccessors);
}
}
@Override
public Set<InputStream> getResourcesAsStream(String path) throws IOException {
return inner.getResourcesAsStream(path);
}
@Override
public Set<String> list(String relativeTo, String path, boolean includeFiles, boolean includeDirectories, boolean recursive) throws IOException {
return inner.list(relativeTo, path, includeFiles, includeDirectories, recursive);
}
@Override
public ClassLoader toClassLoader() {
return new RewritingClassLoader(inner.toClassLoader());
}
}
I then register it using
ServiceLocator.getInstance().setResourceAccessor(new MyCustomResourceAccessor(new ClassLoaderResourceAccessor()));
In Liquibase 4, the API changed and I am having issues figuring out how to properly migrate the above logic. Especially the registration part with the ServiceLocator Instance.
Could someone help me in figuring out this new concept in the latest versions?
Thank you for your time and help!