I have a method that I want to be invoked periodically: every day on 11 am. It is a simple method in Main:
public void loadProduct() {
PropertyConfigurator.configure("log4j.properties");
try {
service.create(product);
logger.info("Creation started");
} catch (Exception e) {
// Log Exception
logger.error(e);
}
}
I have almost figured out how to achieve this with the help of Spring context:
<task:scheduler id="scheduler" pool-size="1"/>
<task:scheduled-tasks scheduler="scheduler">
<task:scheduled ref="productTask" method="loadProduct" cron="0/30 * * * * *"/>
</task:scheduled-tasks>
But how to schedule the task to start every 24 hours on 11 am every day?
Or is there a way to achieve this in Java code?