!60 未启动system模块,其他模块 【bpm\report等模块】,因依赖错误码组件无法启动服务
Merge pull request !60 from 陈晨成/master
This commit is contained in:
commit
6be49dae3a
@ -21,4 +21,14 @@ public interface ErrorCodeLoader {
|
|||||||
ServiceExceptionUtil.put(code, msg);
|
ServiceExceptionUtil.put(code, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 刷新错误码
|
||||||
|
*/
|
||||||
|
void refreshErrorCodes();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 加载错误码
|
||||||
|
*/
|
||||||
|
void loadErrorCodes();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@ import lombok.RequiredArgsConstructor;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.boot.context.event.ApplicationReadyEvent;
|
import org.springframework.boot.context.event.ApplicationReadyEvent;
|
||||||
import org.springframework.context.event.EventListener;
|
import org.springframework.context.event.EventListener;
|
||||||
|
import org.springframework.scheduling.annotation.Async;
|
||||||
import org.springframework.scheduling.annotation.Scheduled;
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
@ -44,11 +45,13 @@ public class ErrorCodeLoaderImpl implements ErrorCodeLoader {
|
|||||||
private LocalDateTime maxUpdateTime;
|
private LocalDateTime maxUpdateTime;
|
||||||
|
|
||||||
@EventListener(ApplicationReadyEvent.class)
|
@EventListener(ApplicationReadyEvent.class)
|
||||||
|
@Async // 异步,保证项目的启动过程,毕竟非关键流程
|
||||||
public void loadErrorCodes() {
|
public void loadErrorCodes() {
|
||||||
this.loadErrorCodes0();
|
this.loadErrorCodes0();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Scheduled(fixedDelay = REFRESH_ERROR_CODE_PERIOD, initialDelay = REFRESH_ERROR_CODE_PERIOD)
|
@Scheduled(fixedDelay = REFRESH_ERROR_CODE_PERIOD, initialDelay = REFRESH_ERROR_CODE_PERIOD)
|
||||||
|
@Override
|
||||||
public void refreshErrorCodes() {
|
public void refreshErrorCodes() {
|
||||||
this.loadErrorCodes0();
|
this.loadErrorCodes0();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user