mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
error-code写入时机调整测试
This commit is contained in:
+9
-8
@@ -9,8 +9,8 @@ import com.cf.imes.module.system.api.errorcode.ErrorCodeApi;
|
||||
import com.cf.imes.module.system.api.errorcode.dto.ErrorCodeAutoGenerateReqDTO;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.boot.context.event.ApplicationReadyEvent;
|
||||
import org.springframework.context.event.EventListener;
|
||||
import org.springframework.boot.web.context.WebServerInitializedEvent;
|
||||
import org.springframework.context.ApplicationListener;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -25,8 +25,7 @@ import java.util.List;
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class ErrorCodeAutoGeneratorImpl implements ErrorCodeAutoGenerator {
|
||||
|
||||
public class ErrorCodeAutoGeneratorImpl implements ErrorCodeAutoGenerator, ApplicationListener<WebServerInitializedEvent> {
|
||||
/**
|
||||
* 应用分组
|
||||
*/
|
||||
@@ -41,9 +40,8 @@ public class ErrorCodeAutoGeneratorImpl implements ErrorCodeAutoGenerator {
|
||||
private final ErrorCodeApi errorCodeApi;
|
||||
|
||||
@Override
|
||||
@EventListener(ApplicationReadyEvent.class)
|
||||
@Async // 异步,保证项目的启动过程,毕竟非关键流程
|
||||
public void execute() {
|
||||
@Async
|
||||
public void onApplicationEvent(WebServerInitializedEvent event) {
|
||||
// 第一步,解析错误码
|
||||
List<ErrorCodeAutoGenerateReqDTO> autoGenerateDTOs = parseErrorCode();
|
||||
log.info("[execute][解析到错误码数量为 ({}) 个]", autoGenerateDTOs.size());
|
||||
@@ -104,5 +102,8 @@ public class ErrorCodeAutoGeneratorImpl implements ErrorCodeAutoGenerator {
|
||||
return autoGenerateDTOs;
|
||||
}
|
||||
|
||||
}
|
||||
@Override
|
||||
public void execute() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user