当前位置: 首页>>代码示例>>Java>>正文


Java Resources.getResourceAsProperties方法代码示例

本文整理汇总了Java中org.apache.ibatis.io.Resources.getResourceAsProperties方法的典型用法代码示例。如果您正苦于以下问题:Java Resources.getResourceAsProperties方法的具体用法?Java Resources.getResourceAsProperties怎么用?Java Resources.getResourceAsProperties使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.ibatis.io.Resources的用法示例。


在下文中一共展示了Resources.getResourceAsProperties方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: shouldRunScriptsUsingProperties

import org.apache.ibatis.io.Resources; //导入方法依赖的package包/类
@Test
public void shouldRunScriptsUsingProperties() throws Exception {
  Properties props = Resources.getResourceAsProperties(JPETSTORE_PROPERTIES);
  DataSource dataSource = new UnpooledDataSource(
      props.getProperty("driver"),
      props.getProperty("url"),
      props.getProperty("username"),
      props.getProperty("password"));
  ScriptRunner runner = new ScriptRunner(dataSource.getConnection());
  runner.setAutoCommit(true);
  runner.setStopOnError(false);
  runner.setErrorLogWriter(null);
  runner.setLogWriter(null);
  runJPetStoreScripts(runner);
  assertProductsTableExistsAndLoaded();
}
 
开发者ID:yuexiahandao,项目名称:MybatisCode,代码行数:17,代码来源:ScriptRunnerTest.java

示例2: createUnpooledDataSource

import org.apache.ibatis.io.Resources; //导入方法依赖的package包/类
public static UnpooledDataSource createUnpooledDataSource(String resource) throws IOException {
    Properties props = Resources.getResourceAsProperties(resource);
    UnpooledDataSource ds = new UnpooledDataSource();
    ds.setDriver(props.getProperty("driver"));
    ds.setUrl(props.getProperty("url"));
    ds.setUsername(props.getProperty("username"));
    ds.setPassword(props.getProperty("password"));
    return ds;
}
 
开发者ID:eyougo,项目名称:mybatis-typehandlers-postgis,代码行数:10,代码来源:BaseDataTest.java

示例3: create

import org.apache.ibatis.io.Resources; //导入方法依赖的package包/类
/**
 * Factory method to create session factory based on config,
 * environment from config and properties file to populate parameters in config ${param}
 */
public SqlSessionFactory create() throws IOException {
    InputStream inputStream = null;
    Properties properties = null;
    inputStream = Resources.getResourceAsStream(configFile);
    properties = Resources.getResourceAsProperties("mybatis/config/mybatis.properties");
    return sqlSessionFactoryBuilder.build(inputStream, environment, properties);
}
 
开发者ID:Iurii-Dziuban,项目名称:mybatis-samples,代码行数:12,代码来源:CustomSqlSessionFactoryBuilder.java

示例4: createUnpooledDataSource

import org.apache.ibatis.io.Resources; //导入方法依赖的package包/类
public static UnpooledDataSource createUnpooledDataSource(String resource) throws IOException {
  Properties props = Resources.getResourceAsProperties(resource);
  UnpooledDataSource ds = new UnpooledDataSource();
  ds.setDriver(props.getProperty("driver"));
  ds.setUrl(props.getProperty("url"));
  ds.setUsername(props.getProperty("username"));
  ds.setPassword(props.getProperty("password"));
  return ds;
}
 
开发者ID:yuexiahandao,项目名称:MybatisCode,代码行数:10,代码来源:BaseDataTest.java

示例5: createPooledDataSource

import org.apache.ibatis.io.Resources; //导入方法依赖的package包/类
public static PooledDataSource createPooledDataSource(String resource) throws IOException {
  Properties props = Resources.getResourceAsProperties(resource);
  PooledDataSource ds = new PooledDataSource();
  ds.setDriver(props.getProperty("driver"));
  ds.setUrl(props.getProperty("url"));
  ds.setUsername(props.getProperty("username"));
  ds.setPassword(props.getProperty("password"));
  return ds;
}
 
开发者ID:yuexiahandao,项目名称:MybatisCode,代码行数:10,代码来源:BaseDataTest.java

示例6: createUnpooledDataSource

import org.apache.ibatis.io.Resources; //导入方法依赖的package包/类
public static UnpooledDataSource createUnpooledDataSource(String resource,
		String dbName)
				throws IOException {
	Properties props = Resources.getResourceAsProperties(resource);
	UnpooledDataSource ds = new UnpooledDataSource();
	ds.setDriver(props.getProperty(dbName + ".driver"));
	ds.setUrl(props.getProperty(dbName + ".url"));
	ds.setUsername(props.getProperty(dbName + ".username"));
	ds.setPassword(props.getProperty(dbName + ".password"));
	return ds;
}
 
开发者ID:wen866595,项目名称:MyBatis-batch,代码行数:12,代码来源:TestBatchBase.java


注:本文中的org.apache.ibatis.io.Resources.getResourceAsProperties方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。