I have a Spring Boot app which has a scheduler that insert data to a remote database at 2 a.m. every day.
@Scheduled(cron = "0 0 2 * * ?")
public void reportDataToDB() {
// code omitted
}
The problem is, the app runs on multiple machines, so the database would receive multiple duplicate insertions of data.
What is the idiomatic way to solve this?