Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

spring boot scheduling #307

Open
uniquejava opened this issue May 1, 2020 · 0 comments
Open

spring boot scheduling #307

uniquejava opened this issue May 1, 2020 · 0 comments

Comments

@uniquejava
Copy link
Owner

uniquejava commented May 1, 2020

Spring cron expression for every day 1:01:am

show me the java code

@EnableScheduling
@SpringBootApplication

public class AwesomeApplication {
}


@Service
@Slf4j
public class ScheduleService {
    @Autowired
    private EventMapper eventMapper;

    // second, minute, hour, day of month, month, day(s) of week
    @Scheduled(cron = "0 * * * * *")
    void checkEvents() {
       ...

    }

}

important note

zone matters in some cases

Scheduled(cron="0 1 1 * * *", zone="Europe/Istanbul")
public void doScheduledWork() {
    //complete scheduled work
}

cron format

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant