Skip to main content

dawdler-client-plug-schedule

Module introduction​

Implements injection of the schedule functionality on the web side.

1. Add the dependency to the pom​

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

2. Usage​

Annotate a method with @Schedule; the method must take no parameters.

@Controller
public class UserController{

/**
*Runs every 5 seconds
**/
@Schedule(cron="*/5 * * * * ?")
public void schedule() {
System.out.println(new Date());
}

}

2.1 The three components that support injection on the web side​

  1. Web controller

  2. Web interceptor HandlerInterceptor

  3. Web listener WebContextListener