|
|
@@ -0,0 +1,31 @@
|
|
|
+package com.uas.ps.message;
|
|
|
+
|
|
|
+import com.uas.ps.message.service.MessageService;
|
|
|
+import javax.annotation.Resource;
|
|
|
+import org.apache.log4j.Logger;
|
|
|
+import org.springframework.context.annotation.Configuration;
|
|
|
+import org.springframework.scheduling.annotation.EnableScheduling;
|
|
|
+import org.springframework.scheduling.annotation.Scheduled;
|
|
|
+
|
|
|
+/**
|
|
|
+ * Created by wangyc on 2018/1/31.
|
|
|
+ *
|
|
|
+ * @version 2018/1/31 19:16 wangyc
|
|
|
+ */
|
|
|
+@Configuration
|
|
|
+@EnableScheduling
|
|
|
+public class SchedulingConfig {
|
|
|
+ private final Logger logger = Logger.getLogger(Logger.class);
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private MessageService messageService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 定时执行发送任务
|
|
|
+ */
|
|
|
+ @Scheduled(cron = "0 0 9 * * ?") // 每10分钟执行一次
|
|
|
+ public void getToken() {
|
|
|
+ logger.info("getToken定时任务启动");
|
|
|
+ messageService.sendMessage("{\"consumerApp\":\"B2B\"}");
|
|
|
+ }
|
|
|
+}
|