因业务需求的增加,有多个数据源,数据源的ip 端口号、用户名、密码都一样,只是数据库名称不一样.
以下的数据源,能否精简合成一个数据源? 然后再在其它类中引用.
dao.js 代码如下:
daoTask : {
type : "com.alibaba.druid.pool.DruidDataSource",
events : {
depose : 'close'
},
fields : {
driverClassName : 'com.microsoft.sqlserver.jdbc.SQLServerDriver',
url : 'jdbc:sqlserver://192.168.8.1:18991;DatabaseName=db_user_task',
username : 'juhe_test',
password : 'juhe_test'
}
},
daoCoin : {
type : "com.alibaba.druid.pool.DruidDataSource",
events : {
depose : 'close'
},
fields : {
driverClassName : 'com.microsoft.sqlserver.jdbc.SQLServerDriver',
url : 'jdbc:sqlserver://192.168.8.1:18991;DatabaseName=db_coin',
username : 'juhe_test',
password : 'juhe_test'
}
},
daoWorldMoney : {
type : "com.alibaba.druid.pool.DruidDataSource",
events : {
depose : 'close'
},
fields : {
driverClassName : 'com.microsoft.sqlserver.jdbc.SQLServerDriver',
url : 'jdbc:sqlserver://192.168.8.1:18991;DatabaseName=db_money',
username : 'juhe_test',
password : 'juhe_test'
}
},
daotask : {
type : "org.nutz.dao.impl.NutDao",
args : [ { refer : "daoTask" } ]
},
daocoin : {
type : "org.nutz.dao.impl.NutDao",
args : [ { refer : "daoCoin" } ]
},
daoworldmoney : {
type : "org.nutz.dao.impl.NutDao",
args : [ { refer : "daoWorldMoney" } ]
},