refactor: 重命名 backend-single 目录为 server
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
package com.emotion.service;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.ApplicationArguments;
|
||||
import org.springframework.boot.ApplicationRunner;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 启动时自动同步接口数据
|
||||
*
|
||||
* @author Peanut
|
||||
* @date 2026-05-23
|
||||
*/
|
||||
@Component
|
||||
public class ApiEndpointSyncRunner implements ApplicationRunner {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(ApiEndpointSyncRunner.class);
|
||||
|
||||
@Autowired
|
||||
private ApiEndpointService apiEndpointService;
|
||||
|
||||
@Async
|
||||
@Override
|
||||
public void run(ApplicationArguments args) throws Exception {
|
||||
log.info("启动同步:开始异步同步接口数据");
|
||||
try {
|
||||
apiEndpointService.syncFromOpenApi();
|
||||
log.info("启动同步:接口数据同步完成");
|
||||
} catch (Exception e) {
|
||||
log.warn("启动同步:接口数据同步失败: {}", e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user