Skip to main content

dawdler-server-plug-schedule

Module introduction​

Implements injection of the schedule functionality on the dawdler-server side.

1. Add the dependency to the pom​

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

2. Usage​

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

public class UserServiceImpl implements UserService {
/**
*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 dawdler server side​

  1. DawdlerFilter service filter

  2. DawdlerServiceListener listener

  3. Interface implementation classes annotated with @Service