This commit is contained in:
Looly 2024-03-26 19:57:15 +08:00
parent b090fbdd3d
commit baad5158a8
3 changed files with 14 additions and 2 deletions

View File

@ -186,4 +186,16 @@ public class ConnectionConfig<T extends ConnectionConfig<?>> {
this.poolProps.setProperty(key, value);
return (T) this;
}
@Override
public String toString() {
return "ConnectionConfig{" +
"driver='" + driver + '\'' +
", url='" + url + '\'' +
", user='" + user + '\'' +
", pass='****" + '\'' +
", connProps=" + connProps +
", poolProps=" + poolProps +
'}';
}
}

View File

@ -56,7 +56,7 @@ public class C3p0DSFactory implements DSFactory {
// 连接配置
final Properties connProps = config.getConnProps();
if(MapUtil.isNotEmpty(connProps)){
ds.setProperties(connProps);
ds.getProperties().putAll(connProps);
}
return ds;

View File

@ -104,7 +104,7 @@ public class DsTest {
public void c3p0DsuserAndPassTest() {
// https://gitee.com/dromara/hutool/issues/I4T7XZ
DSUtil.setGlobalDSFactory(new C3p0DSFactory());
final ComboPooledDataSource ds = (ComboPooledDataSource) ((DSWrapper) DSUtil.getDS("mysql")).getRaw();
final ComboPooledDataSource ds = (ComboPooledDataSource) DSUtil.getDS("mysql").getRaw();
Assertions.assertEquals("root", ds.getUser());
Assertions.assertEquals("123456", ds.getPassword());
}