This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@SpringBootApplication | |
public class QuartzDemoApplication { | |
public static void main(String[] args) { | |
SpringApplication.run(QuartzDemoApplication.class, args); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Bean | |
public Trigger scheduleTrigger() { | |
return newTrigger().withIdentity("trigger").forJob(scheduleJob()). | |
withSchedule(CronScheduleBuilder.cronSchedule("0 * * * * ?")).build(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Bean | |
public JobDetail scheduleJob() { | |
return JobBuilder.newJob(ScheduleTask.class).storeDurably() | |
.withIdentity("sample_schedule").withDescription("Sample schedule task").build(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Component | |
public class ScheduleTask extends QuartzJobBean { | |
private static final Logger LOG = LoggerFactory.getLogger(ScheduleTask.class); | |
private static final SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm:ss"); | |
@Override | |
protected void executeInternal(JobExecutionContext jobExecutionContext) throws JobExecutionException { | |
LOG.info("The current time is: " + dateFormat.format(new Date())); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.mycollab.billing.fastspring | |
import com.fasterxml.jackson.annotation.{JsonCreator, JsonProperty} | |
import com.fasterxml.jackson.core.{JsonGenerator, JsonParser} | |
import com.fasterxml.jackson.databind._ | |
import com.fasterxml.jackson.databind.annotation.{JsonDeserialize, JsonSerialize} | |
import com.fasterxml.jackson.databind.module.SimpleModule | |
import org.joda.time.LocalDateTime | |
import org.joda.time.format.DateTimeFormat |