use of liquibase.servicelocator.ServiceLocator in project spring-boot by spring-projects.
the class LiquibaseServiceLocatorApplicationListenerTests method replacesServiceLocator.
@Test
public void replacesServiceLocator() throws Exception {
SpringApplication application = new SpringApplication(Conf.class);
application.setWebApplicationType(WebApplicationType.NONE);
this.context = application.run();
ServiceLocator instance = ServiceLocator.getInstance();
Field field = ReflectionUtils.findField(ServiceLocator.class, "classResolver");
field.setAccessible(true);
Object resolver = field.get(instance);
assertThat(resolver).isInstanceOf(SpringPackageScanClassResolver.class);
}
use of liquibase.servicelocator.ServiceLocator in project liquibase by liquibase.
the class LogFactory method getLog.
public Logger getLog(String name) {
if (!loggers.containsKey(name)) {
Logger value;
try {
ServiceLocator serviceLocator = ServiceLocator.getInstance();
if (serviceLocator == null) {
//ServiceLocator not yet running
return defaultLogger;
}
value = (Logger) serviceLocator.newInstance(Logger.class);
} catch (Exception e) {
return defaultLogger;
}
value.setName(name);
if (defaultLoggingLevel != null) {
value.setLogLevel(defaultLoggingLevel);
}
loggers.put(name, value);
}
return loggers.get(name);
}
Aggregations