Posted on by | Posted in Azubi Blog, Developer Blog | Tagged , , , , ,

You want to execute cron jobs or call your methods asynchronously? Thanks to Spring's annotation support for scheduling and asynchronous execution you can achieve this in a few minutes.

Some xml magic

At first define your task executor and scheduler. The following lines will create an instance of ThreadPoolTaskExecutor and an instance of ThreadPoolTaskScheduler with the given pool sizes. The task element annotation-driven allows you to use Spring's annotations for scheduling and asynchronous execution within the beans defined in your application context.