package com.kidgrow.oprationcenter.config; import com.kidgrow.oprationcenter.service.IHospitalScreeningService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.CommandLineRunner; import org.springframework.core.annotation.Order; import org.springframework.stereotype.Component; @Component //作为bean加入spring @Order(value = 2)//多个启动任务的执行顺序 public class RedisStartupRunner implements CommandLineRunner { @Autowired IHospitalScreeningService hospitalScreeningService; @Override public void run(String... args) throws Exception { hospitalScreeningService.tableToRedis(); } }