File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed
APIJSON-Java-Server/APIJSONBoot/src/main/java/apijson/demo Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -49,13 +49,13 @@ public class DemoSQLExecutor extends APIJSONSQLExecutor<Long> {
4949 @ Override
5050 public Connection getConnection (SQLConfig config ) throws Exception {
5151 Log .d (TAG , "getConnection config.getDatasource() = " + config .getDatasource ());
52-
53- Connection c = connectionMap .get (config . getDatabase () );
52+ String connectionKey = config . getDatasource () + "-" + config . getDatabase ();
53+ Connection c = connectionMap .get (connectionKey );
5454 if (c == null || c .isClosed ()) {
5555 try {
5656 DataSource ds = DemoApplication .getApplicationContext ().getBean (DataSource .class );
5757 // 另一种方式是 DruidConfig 初始化获取到 Datasource 后给静态变量 DATA_SOURCE 赋值: ds = DruidConfig.DATA_SOURCE.getConnection();
58- connectionMap .put (config . getDatabase () , ds == null ? null : ds .getConnection ());
58+ connectionMap .put (connectionKey , ds == null ? null : ds .getConnection ());
5959 } catch (Exception e ) {
6060 Log .e (TAG , "getConnection try { "
6161 + "DataSource ds = DemoApplication.getApplicationContext().getBean(DataSource.class); .."
You can’t perform that action at this time.
0 commit comments