{"id":17350435,"url":"https://github.com/codecshekhar/spring-boot-scheduler-example","last_synced_at":"2026-04-22T23:33:11.396Z","repository":{"id":257205720,"uuid":"857615734","full_name":"CodeCshekhar/spring-boot-scheduler-example","owner":"CodeCshekhar","description":"This repository contains spring-boot-scheduler-example concepts to illustrate its advantages","archived":false,"fork":false,"pushed_at":"2024-09-15T10:45:42.000Z","size":12,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-27T12:19:16.285Z","etag":null,"topics":["config","custom","scheduler","spring-boot","tasks"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CodeCshekhar.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-09-15T06:09:02.000Z","updated_at":"2024-12-04T07:09:20.000Z","dependencies_parsed_at":"2024-09-15T09:53:46.623Z","dependency_job_id":"a242cc19-fbf3-494d-ad01-9d337b90ac9b","html_url":"https://github.com/CodeCshekhar/spring-boot-scheduler-example","commit_stats":null,"previous_names":["chandrashekharwagh/spring-boot-scheduler-example","codecshekhar/spring-boot-scheduler-example"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/CodeCshekhar/spring-boot-scheduler-example","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodeCshekhar%2Fspring-boot-scheduler-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodeCshekhar%2Fspring-boot-scheduler-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodeCshekhar%2Fspring-boot-scheduler-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodeCshekhar%2Fspring-boot-scheduler-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CodeCshekhar","download_url":"https://codeload.github.com/CodeCshekhar/spring-boot-scheduler-example/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodeCshekhar%2Fspring-boot-scheduler-example/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263469440,"owners_count":23471525,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["config","custom","scheduler","spring-boot","tasks"],"created_at":"2024-10-15T17:06:55.562Z","updated_at":"2026-04-22T23:33:11.365Z","avatar_url":"https://github.com/CodeCshekhar.png","language":"Java","readme":"# Spring Boot Scheduler Example\n\nThis project demonstrates various scheduling techniques using Spring Boot's `@Scheduled` annotation and custom configuration.\n\n## Project Structure\n\n```\n├── src\n│   └── main\n│       ├── java\n│       │   └── com\n│       │       └── example\n│       │           └── scheduler\n│       │               └── SchedulerApplication.java\n│       └── resources\n│           ├── application.properties\n│           ├── data (create this directory)\n│           └── backup (will be created by the application)\n└── pom.xml\n```\n\n## Features\n\n- Custom thread pool configuration for scheduled tasks\n- Various scheduling techniques:\n  - Fixed rate execution\n  - Cron-based scheduling\n  - Fixed delay execution with externalized configuration\n- Simulated tasks:\n  - Logging current time\n  - Checking disk space\n  - User registration simulation\n  - Daily sales report generation\n  - Daily backup process\n\n## Prerequisites\n\n- Java 11 or higher\n- Maven 3.6 or higher\n\n## Setup and Running\n\n1. Clone the repository:\n   ```\n   git clone https://github.com/Chandrashekharwagh/spring-boot-scheduler-example.git\n   cd spring-boot-scheduler-example\n   ```\n\n2. Create the `data` directory:\n   ```\n   mkdir -p src/main/resources/data\n   ```\n\n3. Build the project:\n   ```\n   mvn clean install\n   ```\n\n4. Run the application:\n   ```\n   mvn spring-boot:run\n   ```\n\n## Configuration\n\nThe main configuration is in `src/main/resources/application.properties`:\n\n```properties\nlogging.level.org.springframework=INFO\nlogging.level.com.example=DEBUG\nserver.port=8080\nfixedDelay.in.milliseconds=6000\n```\n\nYou can modify the `fixedDelay.in.milliseconds` value to change the delay for the fixed delay task.\n\n## Main Application Class\n\nThe `SchedulerApplication` class (`src/main/java/com/example/scheduler/SchedulerApplication.java`) contains all the scheduled tasks and configuration. It demonstrates:\n\n- Custom thread pool configuration\n- Implementation of `SchedulingConfigurer`\n- Various `@Scheduled` tasks with different scheduling strategies\n\n## Scheduled Tasks\n\n1. `logCurrentTime()`: Runs every 5 seconds, logging the current time.\n2. `checkDiskSpace()`: Runs every minute, checking and reporting available disk space.\n3. `simulateUserRegistration()`: Runs every 10 seconds, simulating a new user registration.\n4. `generateDailySalesReport()`: Runs at the start of every hour, simulating daily sales reporting.\n5. `performDailyBackup()`: Runs at 2 AM every day, simulating a daily backup process.\n6. `scheduleTaskWithFixedDelay()`: Runs with a fixed delay specified in `application.properties`.\n\n## Customization\n\nYou can modify the scheduling parameters, add new tasks, or adjust the thread pool size in the `SchedulerApplication` class.\n\n## Notes\n\n- The disk space check and backup tasks interact with the file system. Ensure your application has the necessary permissions.\n- The sales report uses random numbers for demonstration. In a real application, you'd typically fetch this data from a database or service.\n- The backup task is a simple file copy operation. In a production environment, you'd want a more robust backup solution.\n\n## Contributing\n\nFeel free to fork this project and submit pull requests with improvements or additional examples of Spring Boot scheduling techniques.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodecshekhar%2Fspring-boot-scheduler-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodecshekhar%2Fspring-boot-scheduler-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodecshekhar%2Fspring-boot-scheduler-example/lists"}