Hi! good people. i'm trying to use quartz with spring in a very simple project managed by maven.So in the module in which the mycron job class is i included a java main class to it just to see the job output some text and new date. here is my spring config:
<!--Scheduling-->
<!--Job-->
<bean id="projUpdater" class="org.springframework.scheduling.quartz.JobDetailBean">
<property name="jobClass" value="com.myproject.utilscheduling.quartz.ProjUpdaterCronImpl" />
</bean>
<!---End of Jobs-->
<!--Triggers-->
<bean id="regularUpdateTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean">
<property name="jobDetail" ref="projUpdater"/>
<property name="cronExpression" value="30 1 * * * ?"/>
</bean>
<!--End ofTriggers-->
<!--Scheduler Factory-->
<bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<property name="triggers">
<list>
<ref bean="regularUpdateTrigger"/>
</list>
</property>
</bean>
<!--End of Scheduler Factory-->
<!--End of Scheduling-->
and here is the job class
public class ProjUpdaterCronImpl extends QuartzJobBean {
public ProjUpdaterCronImpl() {
}
protected void executeInternal (JobExecutionContext ctx) throws JobExecutionException {
System.out.println("[JOB] " + new Date() + "hello");
}
}
here is main class
public class NewMain {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
System.out.println("starting job");
}
}
so in my understanding the job will be started after 1mn30s and posted on the console.I'm wrong.i faced couple or errors that i solve so i can safely assume that there is no error in in spring configuration file since there is none when building and running.So what did i do wrong or what did i forget to do?
second concern since i'm forcing myself to go the test driven way how will i possibly test a the cron job class? thanks for reading