@@ -28,6 +28,11 @@ public class BpmStartedListener implements IStartListener { | |||||
} | } | ||||
@Override | @Override | ||||
public void init() { | |||||
SwConsts.SysParam.RUN_PROJECTS = "bpm"; | |||||
} | |||||
@Override | |||||
public void run() { | public void run() { | ||||
//初始化数据库 | //初始化数据库 | ||||
new DatabaseUtil(true, false).checkDb(); | new DatabaseUtil(true, false).checkDb(); | ||||
@@ -33,9 +33,13 @@ public class CoreApplicationStartedListener implements ApplicationListener<Appli | |||||
applicationContext.publishEvent(new TaskStartEvent()); | applicationContext.publishEvent(new TaskStartEvent()); | ||||
//包扫描 | //包扫描 | ||||
ApplicationScanner.scan(applicationContext); | ApplicationScanner.scan(applicationContext); | ||||
List<IStartListener> list = BeanManager.getInstance().getStartListeners(); | List<IStartListener> list = BeanManager.getInstance().getStartListeners(); | ||||
list.sort(Comparator.comparingInt(IStartListener::order)); | list.sort(Comparator.comparingInt(IStartListener::order)); | ||||
for (IStartListener sl : list) { | for (IStartListener sl : list) { | ||||
sl.init(); | |||||
} | |||||
for (IStartListener sl : list) { | |||||
sl.run(); | sl.run(); | ||||
} | } | ||||
// 通知 controller 正式使用 | // 通知 controller 正式使用 | ||||
@@ -10,7 +10,7 @@ public interface SwConsts { | |||||
//系统启动完成 | //系统启动完成 | ||||
public static boolean SYS_STARTED = false; | public static boolean SYS_STARTED = false; | ||||
//运行的项目,多个用半角逗号分隔 | //运行的项目,多个用半角逗号分隔 | ||||
public static String RUN_PROJECTS = "bpm"; | |||||
public static String RUN_PROJECTS = ""; | |||||
} | } | ||||
@@ -2,10 +2,13 @@ package cc.smtweb.framework.core.mvc.controller; | |||||
/** | /** | ||||
* Created by Akmm at 2022-08-24 09:26 | * Created by Akmm at 2022-08-24 09:26 | ||||
* 启动监听 | |||||
* 启动监听,按order先执行init,再执行run; | |||||
*/ | */ | ||||
public interface IStartListener { | public interface IStartListener { | ||||
//启动执行顺序 | //启动执行顺序 | ||||
int order(); | int order(); | ||||
//初始化设置,一般为设置参数配置 | |||||
void init(); | |||||
//启动事件 | |||||
void run(); | void run(); | ||||
} | } |