在Startup中,无法通过ioc.get(Dao.class)获取到Dao,其中dao.js如下:
dataSource : {
type : "org.nutz.dao.impl.SimpleDataSource",
events:{
depose:"close"
},
fields : {
driverClassName:"com.mysql.jdbc.Driver",
jdbcUrl:"jdbc:mysql://127.0.0.1/ymt-city",
username:"root",
password:"root"
}
},
dao : {
type : "org.nutz.dao.impl.NutDao",
args : [{refer:'dataSource'}]
}
Startup代码片段如下:
Ioc ioc = config.getIoc();
Dao dao = ioc.get(Dao.class);
报异常:
Caused by: java.sql.SQLException: No suitable driver found for jdbc:mysql://127.0.0.1/***
好像使用druid不会这样,是SimpleDataSource不支持在Startup中初始化数据库吗?