From fa1ed59b8d673844e4d8707a5ae32ac72edf28ce Mon Sep 17 00:00:00 2001 From: xuxueli <931591021@qq.com> Date: Mon, 25 Dec 2017 16:41:02 +0800 Subject: [PATCH] =?UTF-8?q?clean=20code;=20=E5=8D=87=E7=BA=A7=E4=BE=9D?= =?UTF-8?q?=E8=B5=96=E7=89=88=E6=9C=AC=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xxl-job-executor-sample-jfinal/pom.xml | 2 +- .../mvc/controller/IndexController.java | 36 +++++++++---------- .../service/jobhandler/DemoJobHandler.java | 10 +++--- 3 files changed, 24 insertions(+), 24 deletions(-) diff --git a/xxl-job-executor-samples/xxl-job-executor-sample-jfinal/pom.xml b/xxl-job-executor-samples/xxl-job-executor-sample-jfinal/pom.xml index 2e6a68ce..17444ffb 100644 --- a/xxl-job-executor-samples/xxl-job-executor-sample-jfinal/pom.xml +++ b/xxl-job-executor-samples/xxl-job-executor-sample-jfinal/pom.xml @@ -16,7 +16,7 @@ com.jfinal jfinal - 2.0 + 2.2 diff --git a/xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/mvc/controller/IndexController.java b/xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/mvc/controller/IndexController.java index 1851d54f..37c90719 100644 --- a/xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/mvc/controller/IndexController.java +++ b/xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/mvc/controller/IndexController.java @@ -1,18 +1,18 @@ -package com.xxl.job.executor.mvc.controller; - -import org.springframework.boot.autoconfigure.EnableAutoConfiguration; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.ResponseBody; - -@Controller -@EnableAutoConfiguration -public class IndexController { - - @RequestMapping("/") - @ResponseBody - String index() { - return "xxl job executor running."; - } - -} \ No newline at end of file +//package com.xxl.job.executor.mvc.controller; +// +//import org.springframework.boot.autoconfigure.EnableAutoConfiguration; +//import org.springframework.stereotype.Controller; +//import org.springframework.web.bind.annotation.RequestMapping; +//import org.springframework.web.bind.annotation.ResponseBody; +// +//@Controller +//@EnableAutoConfiguration +//public class IndexController { +// +// @RequestMapping("/") +// @ResponseBody +// String index() { +// return "xxl job executor running."; +// } +// +//} \ No newline at end of file diff --git a/xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/service/jobhandler/DemoJobHandler.java b/xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/service/jobhandler/DemoJobHandler.java index 79b95c7d..01b4db84 100644 --- a/xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/service/jobhandler/DemoJobHandler.java +++ b/xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/service/jobhandler/DemoJobHandler.java @@ -4,7 +4,7 @@ import com.xxl.job.core.biz.model.ReturnT; import com.xxl.job.core.handler.IJobHandler; import com.xxl.job.core.handler.annotation.JobHandler; import com.xxl.job.core.log.XxlJobLogger; -import org.springframework.stereotype.Service; +import org.springframework.stereotype.Component; import java.util.concurrent.TimeUnit; @@ -13,15 +13,15 @@ import java.util.concurrent.TimeUnit; * 任务Handler的一个Demo(Bean模式) * * 开发步骤: - * 1、继承 “IJobHandler” ; - * 2、装配到Spring,例如加 “@Service” 注解; - * 3、加 “@JobHandler” 注解,注解value值为新增任务生成的JobKey的值;多个JobKey用逗号分割; + * 1、新建一个继承com.xxl.job.core.handler.IJobHandler的Java类; + * 2、该类被Spring容器扫描为Bean实例,如加“@Component”注解; + * 3、添加 “@JobHandler(value="自定义jobhandler名称")”注解,注解的value值为自定义的JobHandler名称,该名称对应的是调度中心新建任务的JobHandler属性的值。 * 4、执行日志:需要通过 "XxlJobLogger.log" 打印执行日志; * * @author xuxueli 2015-12-19 19:43:36 */ @JobHandler(value="demoJobHandler") -@Service +@Component public class DemoJobHandler extends IJobHandler { @Override