This commit is contained in:
Looly
2020-08-16 11:55:30 +08:00
parent ef235aab5d
commit a444d00e98
6 changed files with 56 additions and 25 deletions

View File

@@ -33,6 +33,11 @@ public class BeeDSFactory extends AbstractDSFactory {
final BeeDataSourceConfig beeConfig = new BeeDataSourceConfig(driver, jdbcUrl, user, pass);
poolSetting.toBean(beeConfig);
// 修复BeeCP默认参数无效问题
if(beeConfig.getBorrowConcurrentSize() > beeConfig.getMaxActive()){
beeConfig.setMaxActive(beeConfig.getBorrowConcurrentSize() + 1);
}
// remarks等特殊配置since 5.3.8
String connValue;
for (String key : KEY_CONN_PROPS) {

View File

@@ -2,6 +2,7 @@ package cn.hutool.db;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.db.ds.DSFactory;
import cn.hutool.db.ds.bee.BeeDSFactory;
import cn.hutool.db.ds.c3p0.C3p0DSFactory;
import cn.hutool.db.ds.dbcp.DbcpDSFactory;
import cn.hutool.db.ds.druid.DruidDSFactory;
@@ -59,6 +60,15 @@ public class DsTest {
Assert.assertTrue(CollUtil.isNotEmpty(all));
}
@Test
public void beeCPDsTest() throws SQLException {
DSFactory.setCurrentDSFactory(new BeeDSFactory());
DataSource ds = DSFactory.get("test");
Db db = Db.use(ds);
List<Entity> all = db.findAll("user");
Assert.assertTrue(CollUtil.isNotEmpty(all));
}
@Test
public void dbcpDsTest() throws SQLException {
DSFactory.setCurrentDSFactory(new DbcpDSFactory());