|
|
|
@ -11,6 +11,7 @@ import com.dsideal.base.Interceptor.*;
|
|
|
|
|
import com.dsideal.base.LoginPerson.Controller.LoginPersonController;
|
|
|
|
|
import com.dsideal.base.Menu.Controller.MenuController;
|
|
|
|
|
import com.dsideal.base.Organization.Controller.OrganizationController;
|
|
|
|
|
import com.dsideal.base.Plugin.YamlProp;
|
|
|
|
|
import com.dsideal.base.Student.Controller.StudentController;
|
|
|
|
|
import com.dsideal.base.StudentYd.Controller.StudentYdController;
|
|
|
|
|
import com.dsideal.base.Teacher.Controller.TeacherController;
|
|
|
|
@ -19,7 +20,7 @@ import com.dsideal.base.Util.FileUtil;
|
|
|
|
|
import com.dsideal.base.Util.LogBackLogFactory;
|
|
|
|
|
import com.dsideal.base.Util.PkUtil;
|
|
|
|
|
import com.jfinal.config.*;
|
|
|
|
|
import com.jfinal.kit.PropKit;
|
|
|
|
|
import com.jfinal.kit.Prop;
|
|
|
|
|
import com.jfinal.kit.StrKit;
|
|
|
|
|
import com.jfinal.plugin.activerecord.ActiveRecordPlugin;
|
|
|
|
|
import com.jfinal.plugin.activerecord.dialect.MysqlDialect;
|
|
|
|
@ -46,13 +47,15 @@ public class BaseApplication extends JFinalConfig {
|
|
|
|
|
/**
|
|
|
|
|
* 配置常量
|
|
|
|
|
*/
|
|
|
|
|
Prop PropKit;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void configConstant(Constants me) {
|
|
|
|
|
//使用LogBack
|
|
|
|
|
me.setLogFactory(new LogBackLogFactory());
|
|
|
|
|
//加载配置文件
|
|
|
|
|
String configFile = "application_{?}.properties".replace("{?}", getEnvPrefix());
|
|
|
|
|
PropKit.use(configFile);
|
|
|
|
|
String configFile = "application_{?}.yaml".replace("{?}", getEnvPrefix());
|
|
|
|
|
PropKit = new YamlProp(configFile);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -92,6 +95,7 @@ public class BaseApplication extends JFinalConfig {
|
|
|
|
|
public void configEngine(Engine engine) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 配置插件
|
|
|
|
|
*/
|
|
|
|
@ -106,18 +110,18 @@ public class BaseApplication extends JFinalConfig {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void configPlugin(Plugins me) {
|
|
|
|
|
HikariCpPlugin masterPlugin = new HikariCpPlugin(PropKit.get("jdbcUrl"), PropKit.get("user"),
|
|
|
|
|
PropKit.get("password").trim(), PropKit.get("driverClassName"));
|
|
|
|
|
HikariCpPlugin masterPlugin = new HikariCpPlugin(PropKit.get("mysql.jdbcUrl"), PropKit.get("mysql.user"),
|
|
|
|
|
PropKit.get("mysql.password").trim(), PropKit.get("mysql.driverClassName"));
|
|
|
|
|
masterPlugin.setConnectionTestQuery(connectionTestQuery);
|
|
|
|
|
masterPlugin.setConnectionTimeout(connectionTimeoutMs);
|
|
|
|
|
masterPlugin.setIdleTimeout(idleTimeoutMs);
|
|
|
|
|
masterPlugin.setMaxLifetime(maxLifetimeMs);
|
|
|
|
|
masterPlugin.setMaximumPoolSize(maxPoolSize);
|
|
|
|
|
|
|
|
|
|
String jdbcUrlSlave = PropKit.get("jdbcUrlSlave");
|
|
|
|
|
if (StrKit.isBlank(jdbcUrlSlave)) jdbcUrlSlave = PropKit.get("jdbcUrl");
|
|
|
|
|
HikariCpPlugin slavePlugin = new HikariCpPlugin(jdbcUrlSlave, PropKit.get("user"),
|
|
|
|
|
PropKit.get("password").trim(), PropKit.get("driverClassName"));
|
|
|
|
|
String jdbcUrlSlave = PropKit.get("mysql.jdbcUrlSlave");
|
|
|
|
|
if (StrKit.isBlank(jdbcUrlSlave)) jdbcUrlSlave = PropKit.get("mysql.jdbcUrl");
|
|
|
|
|
HikariCpPlugin slavePlugin = new HikariCpPlugin(jdbcUrlSlave, PropKit.get("mysql.user"),
|
|
|
|
|
PropKit.get("mysql.password").trim(), PropKit.get("mysql.driverClassName"));
|
|
|
|
|
slavePlugin.setConnectionTestQuery(connectionTestQuery);
|
|
|
|
|
slavePlugin.setConnectionTimeout(connectionTimeoutMs);
|
|
|
|
|
slavePlugin.setIdleTimeout(idleTimeoutMs);
|
|
|
|
@ -148,7 +152,7 @@ public class BaseApplication extends JFinalConfig {
|
|
|
|
|
me.add(masterArp);
|
|
|
|
|
me.add(slaveArp);
|
|
|
|
|
// 用于缓存模块的redis服务
|
|
|
|
|
RedisPlugin redis = new RedisPlugin("Redis", PropKit.get("redis_ip"), PropKit.getInt("redis_port"), 10 * 1000);
|
|
|
|
|
RedisPlugin redis = new RedisPlugin("Redis", PropKit.get("redis.ip"), PropKit.getInt("redis.port"), 10 * 1000,PropKit.get("redis.password"));
|
|
|
|
|
//启动redis组件
|
|
|
|
|
me.add(redis);
|
|
|
|
|
}
|
|
|
|
|