SmartReloadConfig.java 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. package net.lab1024.smartadmin.config;
  2. import net.lab1024.smartadmin.common.reload.SmartReloadManager;
  3. import net.lab1024.smartadmin.common.reload.interfaces.SmartReloadThreadLogger;
  4. import lombok.extern.slf4j.Slf4j;
  5. import org.springframework.beans.factory.annotation.Value;
  6. import org.springframework.context.annotation.Bean;
  7. import org.springframework.context.annotation.Configuration;
  8. /**
  9. * [ ]
  10. *
  11. * @author yandanyang
  12. * @version 1.0
  13. * @company 1024lab.net
  14. * @copyright (c) 2018 1024lab.netInc. All rights reserved.
  15. * @date 2019/3/28 0028 下午 20:15
  16. * @since JDK1.8
  17. */
  18. @Slf4j
  19. @Configuration
  20. public class SmartReloadConfig {
  21. @Value("${smart-reload.thread-count}")
  22. private Integer threadCount;
  23. @Bean
  24. public SmartReloadManager initSmartReloadManager() {
  25. /**
  26. * 创建 Reload Manager 调度器
  27. */
  28. SmartReloadManager smartReloadManager = new SmartReloadManager(new SmartReloadThreadLogger() {
  29. @Override
  30. public void error(String string) {
  31. log.error(string);
  32. }
  33. @Override
  34. public void error(String string, Throwable e) {
  35. log.error(string, e);
  36. }
  37. }, threadCount);
  38. return smartReloadManager;
  39. }
  40. }