Make isPresent check more Graal-friendly

Closes gh-23925
pull/23958/head
Andy Wilkinson 4 years ago
parent 506f7acc8d
commit 74ec5f65d1

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2019 the original author or authors. * Copyright 2012-2020 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -37,10 +37,13 @@ public class LiquibaseServiceLocatorApplicationListener implements ApplicationLi
private static final Log logger = LogFactory.getLog(LiquibaseServiceLocatorApplicationListener.class); private static final Log logger = LogFactory.getLog(LiquibaseServiceLocatorApplicationListener.class);
private static final boolean LIQUIBASE_PRESENT = ClassUtils.isPresent(
"liquibase.servicelocator.CustomResolverServiceLocator",
LiquibaseServiceLocatorApplicationListener.class.getClassLoader());
@Override @Override
public void onApplicationEvent(ApplicationStartingEvent event) { public void onApplicationEvent(ApplicationStartingEvent event) {
if (ClassUtils.isPresent("liquibase.servicelocator.CustomResolverServiceLocator", if (LIQUIBASE_PRESENT) {
event.getSpringApplication().getClassLoader())) {
new LiquibasePresent().replaceServiceLocator(); new LiquibasePresent().replaceServiceLocator();
} }
} }

Loading…
Cancel
Save