How to load a cron expression from db and reschedule it with Spring?

23,190

I found a solution by following this : Spring @Scheduled annotation

and this : http://tutorials.jenkov.com/java-util-concurrent/scheduledexecutorservice.html

Share:
23,190
Alexis B.
Author by

Alexis B.

Hello, I'm Alexis, a young software developper who loves StackOverflow. I will try to help you but I have to admit that as a begginer, I will most need help from you! :) Languages : Java & C#

Updated on January 30, 2020

Comments

  • Alexis B.
    Alexis B. over 4 years

    I'm using Spring scheduling to have batches in my application.

    @Scheduled(cron = "${batch.name|0 0 21 * * ?}")
    public void restart() { }
    

    Values are load from a properties file and default value from the @Scheduled annotation parameter.

    Now, I would like to be able to load a cron value from database (so from an object) without using Quartz library, only with the default Spring scheduler.

    Does someone know if and how it is possible?

    Thank you in advance.