use of com.jfinal.plugin.druid.DruidPlugin in project my_curd by qinyou.
the class AppConfig method configPlugin.
@Override
public void configPlugin(Plugins me) {
DruidPlugin dbPlugin = new DruidPlugin(PropKit.get("jdbcUrl"), PropKit.get("user"), PropKit.get("password"));
// druid 监控
dbPlugin.addFilter(new StatFilter());
WallFilter wall = new WallFilter();
wall.setDbType("mysql");
dbPlugin.addFilter(wall);
ActiveRecordPlugin arp = new ActiveRecordPlugin(dbPlugin);
arp.setShowSql(PropKit.getBoolean("devMode"));
arp.setDialect(new MysqlDialect());
MappingKit.mapping(arp);
me.add(dbPlugin);
me.add(arp);
}
use of com.jfinal.plugin.druid.DruidPlugin in project my_curd by qinyou.
the class SchemaInfoUtil method main.
public static void main(String[] args) {
// 注意 InformationSchema=true
DruidPlugin dp = new DruidPlugin("jdbc:mysql://127.0.0.1/my_curd?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useInformationSchema=true", "root", "123456");
dp.start();
Dialect mysqlDialect = new MysqlDialect();
SchemaInfoUtil util = new SchemaInfoUtil(mysqlDialect, dp.getDataSource());
List<Table> tables = util.getAllTableInfo(true);
DbKit.getConfig().getDialect();
DbKit.getConfig().getDataSource();
System.out.println(JsonKit.toJson(tables));
}
Aggregations