*/
public class MoreDataSourceWarp implements Module {
public void loadModule(ApiBinder apiBinder) throws Throwable {
{
//MySQL
Settings settings = apiBinder.getEnvironment().getSettings();
String driverString = settings.getString("demo-jdbc-mysql.driver");
String urlString = settings.getString("demo-jdbc-mysql.url");
String userString = settings.getString("demo-jdbc-mysql.user");
String pwdString = settings.getString("demo-jdbc-mysql.password");
//配置数据源
DataSource dataSource = C3p0DataSourceFactory.createDataSource(driverString, urlString, userString, pwdString);
this.configDataSource(apiBinder, dataSource, "mysql");
}
{
//HSQL
Settings settings = apiBinder.getEnvironment().getSettings();
String driverString = settings.getString("demo-jdbc-hsql.driver");
String urlString = settings.getString("demo-jdbc-hsql.url");
String userString = settings.getString("demo-jdbc-hsql.user");
String pwdString = settings.getString("demo-jdbc-hsql.password");
//配置数据源
DataSource dataSource = C3p0DataSourceFactory.createDataSource(driverString, urlString, userString, pwdString);
this.configDataSource(apiBinder, dataSource, "hsql");
}
}