添加数据库连接
This commit is contained in:
parent
9a916030c3
commit
d4d125f471
|
@ -1,9 +1,14 @@
|
||||||
package com.cyx.config;
|
package com.cyx.config;
|
||||||
|
|
||||||
|
import com.alibaba.druid.filter.stat.StatFilter;
|
||||||
|
import com.cyx.db.Jdbc;
|
||||||
import com.jfinal.config.JFinalConfig;
|
import com.jfinal.config.JFinalConfig;
|
||||||
import com.jfinal.config.*;
|
import com.jfinal.config.*;
|
||||||
import com.jfinal.kit.PropKit;
|
import com.jfinal.kit.PropKit;
|
||||||
|
import com.jfinal.plugin.activerecord.ActiveRecordPlugin;
|
||||||
|
import com.jfinal.plugin.activerecord.dialect.AnsiSqlDialect;
|
||||||
import com.jfinal.plugin.cron4j.Cron4jPlugin;
|
import com.jfinal.plugin.cron4j.Cron4jPlugin;
|
||||||
|
import com.jfinal.plugin.druid.DruidPlugin;
|
||||||
import com.jfinal.template.Engine;
|
import com.jfinal.template.Engine;
|
||||||
/**
|
/**
|
||||||
* @Author Created by cyx.zhang Administrator on 2024/3/1 16:11 周五
|
* @Author Created by cyx.zhang Administrator on 2024/3/1 16:11 周五
|
||||||
|
@ -26,6 +31,19 @@ public class AppConfig extends JFinalConfig {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void configPlugin(Plugins plugins) {
|
public void configPlugin(Plugins plugins) {
|
||||||
|
//配置Druid数据库连接池插件
|
||||||
|
DruidPlugin druidPlugin = Jdbc.createDruidPlugin();
|
||||||
|
//配置Druid数据库连接池大小
|
||||||
|
druidPlugin.set(20, 20, 100);
|
||||||
|
//添加 StatFilter 才会有统计数据
|
||||||
|
druidPlugin.addFilter(new StatFilter());
|
||||||
|
plugins.add(druidPlugin);
|
||||||
|
|
||||||
|
//配置ActiveRecord插件
|
||||||
|
ActiveRecordPlugin arp = new ActiveRecordPlugin(druidPlugin);
|
||||||
|
plugins.add(arp);
|
||||||
|
arp.setDialect(new AnsiSqlDialect());
|
||||||
|
|
||||||
//配置任务调度插件
|
//配置任务调度插件
|
||||||
Cron4jPlugin cp = new Cron4jPlugin(PropKit.use("cron4j.properties"),"cron4j");
|
Cron4jPlugin cp = new Cron4jPlugin(PropKit.use("cron4j.properties"),"cron4j");
|
||||||
plugins.add(cp);
|
plugins.add(cp);
|
||||||
|
|
Loading…
Reference in New Issue