Java Spring @Scheduled tasks executing twice

If you look at the documentation, there is a note that explicitly calls out this phenomenon.

The note is under section 25.5.1 at this link, and reads:

Make sure that you are not initializing multiple instances of the same @Scheduled annotation class at runtime, unless you do want to schedule callbacks to each such instance. Related to this, make sure that you do not use @Configurable on bean classes which are annotated with @Scheduled and registered as regular Spring beans with the container: You would get double initialization otherwise, once through the container and once through the @Configurable aspect, with the consequence of each @Scheduled method being invoked twice.

I understand that this is merely suggestion at this point, but I do not think we have enough information to diagnose the issue further.

Leave a Comment