Unlocking the Power of Scheduled Jobs in Spring Boot

Unlocking the Power of Scheduled Jobs in Spring Boot

1.304 Lượt nghe
Unlocking the Power of Scheduled Jobs in Spring Boot
Today we have another bit of a fullstack demo for those new to using Java Spring Boot. We'll be looking at Scheduled Jobs, also known as Scheduled Tasks. There are 3 options when using Scheduled in Java Spring Boot, and we'll go through all 3: 1. FixedDelay - The same thread executes the Job. If the thread is busy when the next execution is timed to occur, Spring Boot will wait until the thread is complete 2. FixedRate - The Job is executed by a different thread, with the help of "Async" annotation. This means that even when a Job has not finished before the next execution is launched, Spring Boot will create it using a different thread 3. Cron - Similar to Unix / Linux sysadmin work, we can use a "cron" expression to schedule a Job I hope you have a lot of fun with this project, and that it inspires you to pursue your own creative design! 👉👉Grab the source! https://github.com/wazooinc/spring-boot-3-scheduled-jobs 🔗Grab My Other Products Available: - Packaging a JavaScript Frontend in Java Spring Boot: https://t.ly/gaKyT - Build Your First Web Service with Java Spring Boot: https://t.ly/iv_84 👋🏻Connect with me: Twitter: https://www.twitter.com/eyuzwa 🔗References: - Docker Desktop Client: https://www.docker.com/ - Cron Reference: https://crontab.cronhub.io/ ===---=== Chapters ===---=== 00:00 - Introduction 00:13 - What are Scheduled Jobs? 01:14 - Generate Project 02:05 - Setting up Project Basics 06:01 - Sketching out the ProductInventoryJob 07:45 - a FixedDelay Scheduled Job 09:40 - @EnableScheduling 10:55 - a FixedRate Scheduled Job 12:42 - @EnableAsync 13:18 - Checking the Database 14:31 - a Cron Scheduled Job #springboot #docker #scheduledjobs