A basic Spring Boot application that showcases scheduling using the @Scheduled
annotation.
Follow these instructions to build and run the example program.
- Pre-requisite: Java
- I used Java 21
- Build the program distribution
-
./gradlew installDist
-
- Run the app:
-
./build/install/scheduling/bin/scheduling
- Notice how the custom "Spreading good vibes!" message is printed every 10 seconds.
-
2024-04-05T00:31:24.570-05:00 INFO 36375 --- [ main] d.spring_playground.scheduling.Main : Started Main in 0.368 seconds (process running for 0.529) 2024-04-05T00:31:25.013-05:00 INFO 36375 --- [ scheduling-1] d.s.scheduling.GoodVibesService : Spreading good vibes! 2024-04-05T00:31:35.004-05:00 INFO 36375 --- [ scheduling-1] d.s.scheduling.GoodVibesService : Spreading good vibes! 2024-04-05T00:31:45.002-05:00 INFO 36375 --- [ scheduling-1] d.s.scheduling.GoodVibesService : Spreading good vibes!
-
- Stop the app.
- Use the
Ctrl+C
key combination to stop the Gradlerun
task.
- Use the