Im writting a Spring Application, which has to run a task in a new thread that should be started every couple of seconds. My XML looks like this:
<bean id="checkEmail" class="com.turbineam.dataloader.commons.QuartzSchedulerBean"></bean>
<bean id="scheduledTask" class="org.springframework.scheduling.timer.ScheduledTimerTask">
<property name="delay" value="1000" />
<property name="period" value="1000" />
<property name="timerTask" ref="checkEmail" />
</bean>
And for Java code I have:
package com.turbineam.dataloader.commons;
import java.util.TimerTask;
public class QuartzSchedulerBean extends TimerTask {
@Override
public void run() {
System.out.println("printMe!");
}
}
But it doesn’t affect my whole program (which makes something else)
how can I make this right?
Kind Regards,
Rafał
You’re missing a TaskExecutor implementation.
See: http://static.springsource.org/spring/docs/2.5.x/reference/scheduling.html#scheduling-task-executor