Şu satırı dahil ederiz.
import org.quartz.Job;
Açıklaması şöyle
an interface to be implemented by components that you wish to have executed by the scheduler
execute metodu
ÖrnekŞöyle yaparız
@Slf4j
@Component
@PersistJobDataAfterExecution
@DisallowConcurrentExecution
public class SampleJob implements Job {
@Autowired
private TestRepository testRepository;
@Override
public void execute(JobExecutionContext context)
throws JobExecutionException {
...
}
}
ÖrnekŞu satırı dahil ederiz.
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
Şöyle yaparız.
public class SomeJob implements Job {
@Override
public void execute(final JobExecutionContext context) throws JobExecutionException {
//do stuff
}
}
Hiç yorum yok:
Yorum Gönder