package com.mzl.flower.config; import com.mzl.flower.service.system.CodeService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.CommandLineRunner; import org.springframework.stereotype.Component; @Component @Slf4j public class DataCacheInitComponent implements CommandLineRunner { @Autowired private CodeService dictService; @Override public void run(String... args) throws Exception { log.info("初始化字典数据到缓存"); dictService.refreshCache(); } }