public static void startPlugin() { //加载数据库配置文件 Prop p = PropKit.use("init.properties"); DruidPlugin druidPlugin = new DruidPlugin(p.get("jdbcUrl"), p.get("username").trim(), p.get("password").trim()); ActiveRecordPlugin arp = new ActiveRecordPlugin("mysql",druidPlugin); //加载操作表 arp.addMapping(SysUser.TABLE, SysUser.class); //启动 druidPlugin.start(); arp.start(); } public static void main( String[] args ) { startPlugin(); //db operation System.out.println(Db.query("select * from "+SysUser.TABLE+" ")); }