Skip to main content

dawdler-client-plug-schedule

模块介绍​

实现web端注入schedule的功能.

1. pom中引入依赖​

<groupId>club.dawdler</groupId>
<artifactId>dawdler-client-plug-schedule</artifactId>

2. 使用方式​

通过@Schedule标识方法,方法参数必须为无参.

@Controller
public class UserController{

/**
*每5秒执行一次
**/
@Schedule(cron="*/5 * * * * ?")
public void schedule() {
System.out.println(new Date());
}

}

2.1 web端支持注入的三种组件​

1、 web端controller

2、 web端拦截器HandlerInterceptor

3、 web端监听器WebContextListener