'Scheduled task runs in Intellij but not using mvn spring-boot:run

I have a Spring boot application where I have done all the things correctly for scheduling as evidenced by the fact that when I run within Intellij the scheduled task does get invoked, so I'm not bothering to paste my code here. This is on a development machine. But the same code when I run it on the runtime machine from command line with mvn spring-boot:run it never invokes the scheduled task. I don't have lazy init set to true in my application.properties. I have no clue what to do now. Any ideas?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source