當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。