package com.fzzy.gateway; import com.fzzy.gateway.hx2023.service.ApiInitService; import com.fzzy.mqtt.MqttPublishService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.CommandLineRunner; import org.springframework.core.annotation.Order; import org.springframework.stereotype.Service; import javax.annotation.Resource; /** * 配置随系统启动默认配置 */ @Service @Slf4j @Order(value = 2) public class GatewayRunner implements CommandLineRunner { @Resource private ApiInitService apiInitService; @Autowired private MqttPublishService mqttPublishService; @Autowired private GatewayTimerScheduled scheduled; @Override public void run(String... args) throws Exception { mqttPublishService.init(); //执行初始化方案 apiInitService.init(); //获取气象信息 scheduled.doWeatherExe(); //更新设备缓存 apiInitService.updateDeviceCache(); } }