本文整理匯總了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();
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}