Skip to content

Add check for missing Liquibase's class CustomResolverServiceLocator #11625

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
*
* @author Phillip Webb
* @author Dave Syer
* @author Eddú Meléndez
*/
public class LiquibaseServiceLocatorApplicationListener
implements ApplicationListener<ApplicationStartingEvent> {
Expand All @@ -51,12 +52,14 @@ public void onApplicationEvent(ApplicationStartingEvent event) {
private static class LiquibasePresent {

public void replaceServiceLocator() {
CustomResolverServiceLocator customResolverServiceLocator = new CustomResolverServiceLocator(
new SpringPackageScanClassResolver(logger));
customResolverServiceLocator.addPackageToScan(
CommonsLoggingLiquibaseLogger.class.getPackage().getName());
ServiceLocator.setInstance(customResolverServiceLocator);
liquibase.logging.LogFactory.reset();
if (ClassUtils.isPresent("liquibase.servicelocator.CustomResolverServiceLocator", null)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we please have a test that exercises this behaviour. You can use the FilteredClassLoader for that.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the new check is in the wrong place. I’d expect it to replace the existing check above.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, given that we use Liquibase 3.5.x in 1.5, it would be worth looking to see if there’s a class that’s new in 3.5 that we can check for. We should review the auto-configuration conditions too.

CustomResolverServiceLocator customResolverServiceLocator = new CustomResolverServiceLocator(
new SpringPackageScanClassResolver(logger));
customResolverServiceLocator.addPackageToScan(
CommonsLoggingLiquibaseLogger.class.getPackage().getName());
ServiceLocator.setInstance(customResolverServiceLocator);
liquibase.logging.LogFactory.reset();
}
}

}
Expand Down