Java: How do I run function repeatedly every week Sunday at 12:01 AM?

Solution 1:

Use the @Scheduled annotation from Spring framework. The cron expression for every week Sunday at 12:01 AM is: 1 0 * * 0

    @Scheduled(cron="1 0 * * 0")
    public void doSomething() {
        // something that execute once a week
    }