本文整理汇总了Java中liquibase.servicelocator.ServiceLocator.getInstance方法的典型用法代码示例。如果您正苦于以下问题:Java ServiceLocator.getInstance方法的具体用法?Java ServiceLocator.getInstance怎么用?Java ServiceLocator.getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类liquibase.servicelocator.ServiceLocator
的用法示例。
在下文中一共展示了ServiceLocator.getInstance方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getLiquibase
import liquibase.servicelocator.ServiceLocator; //导入方法依赖的package包/类
private Liquibase getLiquibase(Connection connection) throws Exception {
ServiceLocator sl = ServiceLocator.getInstance();
if (!System.getProperties().containsKey("liquibase.scan.packages")) {
if (sl.getPackages().remove("liquibase.core")) {
sl.addPackageToScan("liquibase.core.xml");
}
if (sl.getPackages().remove("liquibase.parser")) {
sl.addPackageToScan("liquibase.parser.core.xml");
}
if (sl.getPackages().remove("liquibase.serializer")) {
sl.addPackageToScan("liquibase.serializer.core.xml");
}
sl.getPackages().remove("liquibase.ext");
sl.getPackages().remove("liquibase.sdk");
}
LogFactory.setInstance(new LogWrapper());
Database database = DatabaseFactory.getInstance().findCorrectDatabaseImplementation(new JdbcConnection(connection));
return new Liquibase(CHANGELOG, new ClassLoaderResourceAccessor(getClass().getClassLoader()), database);
}
示例2: replacesServiceLocator
import liquibase.servicelocator.ServiceLocator; //导入方法依赖的package包/类
@Test
public void replacesServiceLocator() throws Exception {
SpringApplication application = new SpringApplication(Conf.class);
application.setWebEnvironment(false);
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);
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:12,代码来源:LiquibaseServiceLocatorApplicationListenerTests.java
示例3: checkChangelogExists
import liquibase.servicelocator.ServiceLocator; //导入方法依赖的package包/类
@PostConstruct
public void checkChangelogExists() {
if (this.properties.isCheckChangeLogLocation()) {
Resource resource = this.resourceLoader
.getResource(this.properties.getChangeLog());
Assert.state(resource.exists(),
"Cannot find changelog location: " + resource
+ " (please add changelog or check your Liquibase "
+ "configuration)");
}
ServiceLocator serviceLocator = ServiceLocator.getInstance();
serviceLocator.addPackageToScan(
CommonsLoggingLiquibaseLogger.class.getPackage().getName());
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:15,代码来源:LiquibaseAutoConfiguration.java
示例4: replacesServiceLocator
import liquibase.servicelocator.ServiceLocator; //导入方法依赖的package包/类
@Test
public void replacesServiceLocator() throws Exception {
SpringApplication application = new SpringApplication(Conf.class);
application.setWebEnvironment(false);
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, instanceOf(SpringPackageScanClassResolver.class));
}
开发者ID:Nephilim84,项目名称:contestparser,代码行数:12,代码来源:LiquibaseServiceLocatorApplicationListenerTests.java