mardi 24 mars 2015

Spring @Scheduled issue with Scheduling

I am have bean I want to function in spring I want run only once a day at midnight. for test it put date into queue when it runs and dies.


I am having issue making it work as it should.



@Scheduled(cron = "1 0 * * * *")


when I put it this way, the the function is executed every hour instead of every midnight


"Tue Mar 24 12:00:02 PDT 2015": "Reset", "Tue Mar 24 13:00:02 PDT 2015": "Reset"


Here is my confs as well



<context:component-scan base-package="com.bla" />

<mvc:annotation-driven />

<task:annotation-driven executor="taskExecutor"
scheduler="taskScheduler"/>

<task:scheduler id="taskScheduler" pool-size="1" />


<bean id="taskExecutor"


class="org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor"
destroy-method="shutdown">

<property name="corePoolSize" value="100" />

<property name="maxPoolSize" value="150" />

<property name="WaitForTasksToCompleteOnShutdown" value="false" />

</bean>

Aucun commentaire:

Enregistrer un commentaire