You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
1.5 KiB
Java

package com.supervision;
import cn.hutool.core.thread.ThreadUtil;
import com.supervision.service.MatchToolService;
import lombok.extern.slf4j.Slf4j;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
@Slf4j
@SpringBootApplication
@MapperScan(basePackages = {"com.supervision.**.mapper"})
public class InterroRobotApplication {
public static void main(String[] args) {
ConfigurableApplicationContext applicationContext = SpringApplication.run(InterroRobotApplication.class, args);
refreshMatchToolLibraryDelay(applicationContext,5*60*1000);
}
public static void refreshMatchToolLibraryDelay(ConfigurableApplicationContext applicationContext,long delay) {
ThreadUtil.newThread(() -> {
try {
log.info("=============等待{}ms刷新向量匹配库=================",delay);
Thread.sleep(delay);
log.info("=============刷新向量匹配库=================");
applicationContext.getBean(MatchToolService.class).refreshMatchToolLibrary();
log.info("=============刷新向量匹配库完成=================");
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
},"refreshMatchToolLibrary").start();
}
}