It is not too simple to create scheduled tasks based on spring boot applications. Add @Configuration @EnableScheduling annotations to a class, and then add @Scheduled(cron = "${case.phase.cron}") to the methods that need to be executed regularly. annotation. Just OK.
${case.phase.cron} indicates that case.phase.cron is taken from the application configuration file application.properties, or taken from config-server.
import java.util.List; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Configuration; import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.Scheduled; /** * Scheduled tasks * To call the standard interface for checking the status of the document * */ @Configuration @EnableScheduling public class CasePhaseTaskService { private static final Logger LOGGER = LoggerFactory.getLogger(CasePhaseTaskService.class); @Scheduled(cron = "${case.phase.cron}") public void execScheduledTask() { LOGGER.info( "task started..." ); LOGGER.info( "task finished!" ); } }