|
|
@@ -1,6 +1,7 @@ |
|
|
|
package cc.smtweb.framework.core; |
|
|
|
|
|
|
|
import cc.smtweb.framework.core.cache.CacheManager; |
|
|
|
import cc.smtweb.framework.core.common.SwConsts; |
|
|
|
import cc.smtweb.framework.core.db.impl.DatabaseUtil; |
|
|
|
import cc.smtweb.framework.core.mvc.controller.scan.ApplicationScanner; |
|
|
|
import cc.smtweb.framework.core.systask.TaskStartEvent; |
|
|
@@ -9,12 +10,14 @@ import lombok.SneakyThrows; |
|
|
|
import org.springframework.boot.context.event.ApplicationStartedEvent; |
|
|
|
import org.springframework.context.ApplicationListener; |
|
|
|
import org.springframework.context.ConfigurableApplicationContext; |
|
|
|
import org.springframework.core.annotation.Order; |
|
|
|
import org.springframework.stereotype.Component; |
|
|
|
|
|
|
|
/** |
|
|
|
* 执行接口扫描任务 |
|
|
|
*/ |
|
|
|
@Component |
|
|
|
@Order(SwConsts.DEFAULT_ORDER) |
|
|
|
public class CoreApplicationStartedListener implements ApplicationListener<ApplicationStartedEvent> { |
|
|
|
@SneakyThrows |
|
|
|
@Override |
|
|
@@ -25,10 +28,6 @@ public class CoreApplicationStartedListener implements ApplicationListener<Appli |
|
|
|
applicationContext.publishEvent(new TaskStartEvent()); |
|
|
|
//包扫描 |
|
|
|
ApplicationScanner.scan(applicationContext); |
|
|
|
//初始化数据库 |
|
|
|
new DatabaseUtil(true, false).checkDb(); |
|
|
|
//初始化缓存 |
|
|
|
CacheManager.getIntance().init(); |
|
|
|
|
|
|
|
// 通知 controller 正式使用 |
|
|
|
applicationContext.publishEvent(new WebStartedEvent()); |
|
|
|