Agendando envio de email com Quartz
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-quartz</artifactId>
</dependency>@Configuration
public class SendBookLoanNotificationScheduleJob extends QuartzJobBean {
@Autowired
private Job job;
@Autowired
private JobExplorer jobExplorer;
@Autowired
private JobLauncher jobLaucher;
@Override
protected void executeInternal(JobExecutionContext context) throws JobExecutionException {
JobParameters jobParameters = new JobParametersBuilder(this.jobExplorer).getNextJobParameters(this.job).toJobParameters();
try {
this.jobLaucher.run(this.job, jobParameters);
} catch (Exception e) {
e.printStackTrace();
}
}
}Atualizado