StartRunning.java 1.0 KB

123456789101112131415161718192021222324252627282930313233343536
  1. package com.qmth.distributed.print.start;
  2. import com.qmth.teachcloud.common.service.AuthInfoService;
  3. import com.qmth.teachcloud.common.service.SysConfigService;
  4. import org.slf4j.Logger;
  5. import org.slf4j.LoggerFactory;
  6. import org.springframework.boot.CommandLineRunner;
  7. import org.springframework.stereotype.Component;
  8. import javax.annotation.Resource;
  9. /**
  10. * @Description: 服务启动时初始化运行,哪个微服务模块需要则拿此模版去用
  11. * @Param:
  12. * @return:
  13. * @Author: wangliang
  14. * @Date: 2020/7/3
  15. */
  16. @Component
  17. public class StartRunning implements CommandLineRunner {
  18. private final static Logger log = LoggerFactory.getLogger(StartRunning.class);
  19. @Resource
  20. AuthInfoService authInfoService;
  21. @Resource
  22. SysConfigService sysConfigService;
  23. @Override
  24. public void run(String... args) throws Exception {
  25. log.info("服务器启动时执行 start");
  26. sysConfigService.selectAll();
  27. authInfoService.appInfoInit();
  28. log.info("服务器启动时执行 end");
  29. }
  30. }