clean code; 升级依赖版本;

master
xuxueli 7 years ago
parent 7a8937ddf4
commit fa1ed59b8d
  1. 2
      xxl-job-executor-samples/xxl-job-executor-sample-jfinal/pom.xml
  2. 36
      xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/mvc/controller/IndexController.java
  3. 10
      xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/service/jobhandler/DemoJobHandler.java

@ -16,7 +16,7 @@
<dependency> <dependency>
<groupId>com.jfinal</groupId> <groupId>com.jfinal</groupId>
<artifactId>jfinal</artifactId> <artifactId>jfinal</artifactId>
<version>2.0</version> <version>2.2</version>
</dependency> </dependency>
<!-- slf4j --> <!-- slf4j -->

@ -1,18 +1,18 @@
package com.xxl.job.executor.mvc.controller; //package com.xxl.job.executor.mvc.controller;
//
import org.springframework.boot.autoconfigure.EnableAutoConfiguration; //import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.stereotype.Controller; //import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping; //import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody; //import org.springframework.web.bind.annotation.ResponseBody;
//
@Controller //@Controller
@EnableAutoConfiguration //@EnableAutoConfiguration
public class IndexController { //public class IndexController {
//
@RequestMapping("/") // @RequestMapping("/")
@ResponseBody // @ResponseBody
String index() { // String index() {
return "xxl job executor running."; // return "xxl job executor running.";
} // }
//
} //}

@ -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.IJobHandler;
import com.xxl.job.core.handler.annotation.JobHandler; import com.xxl.job.core.handler.annotation.JobHandler;
import com.xxl.job.core.log.XxlJobLogger; import com.xxl.job.core.log.XxlJobLogger;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Component;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
@ -13,15 +13,15 @@ import java.util.concurrent.TimeUnit;
* 任务Handler的一个DemoBean模式 * 任务Handler的一个DemoBean模式
* *
* 开发步骤 * 开发步骤
* 1继承 IJobHandler * 1新建一个继承com.xxl.job.core.handler.IJobHandler的Java类
* 2装配到Spring例如加 @Service 注解 * 2该类被Spring容器扫描为Bean实例如加@Component注解
* 3 @JobHandler 注解注解value值为新增任务生成的JobKey的值;多个JobKey用逗号分割; * 3 @JobHandler(value="自定义jobhandler名称")注解注解的value值为自定义的JobHandler名称该名称对应的是调度中心新建任务的JobHandler属性的值
* 4执行日志需要通过 "XxlJobLogger.log" 打印执行日志 * 4执行日志需要通过 "XxlJobLogger.log" 打印执行日志
* *
* @author xuxueli 2015-12-19 19:43:36 * @author xuxueli 2015-12-19 19:43:36
*/ */
@JobHandler(value="demoJobHandler") @JobHandler(value="demoJobHandler")
@Service @Component
public class DemoJobHandler extends IJobHandler { public class DemoJobHandler extends IJobHandler {
@Override @Override

Loading…
Cancel
Save