
# Differences from Spring

`spring_boot_starter_scheduling` follows Spring's `@Scheduled`, `TaskScheduler`, triggers and cron syntax. This page lists where it does not, and why.

## Why

The differences come from Dart: one event loop instead of a thread pool, no time zone database, no overloading, `Future`s, and timers that cannot wait 25 days in JavaScript.

## Example

```dart
@Scheduled(fixedRate: Duration(minutes: 5))
Future<void> refresh() => cache.refresh(); // awaited before the next run
```

```java
@Scheduled(fixedRate = 5, timeUnit = TimeUnit.MINUTES)
CompletableFuture<Void> refresh() { ... } // not awaited
```

## Differences

| Spring | Here | Why |
|---|---|---|
| `@EnableScheduling` | not needed; `spring.task.scheduling.enabled=false` switches it off | The starter is enough. |
| Any time zone in `zone` | local time or UTC only | Dart has no time zone database. |
| Numbers plus `timeUnit` | `Duration`s | |
| `schedule(task, Instant)` | `scheduleAt(task, DateTime)` | No overloading. |
| `ScheduledFuture` | `ScheduledTask` | |
| A `PeriodicTrigger` planned with the wall clock | runs on the task's own timeline, as `scheduleAtFixedRate` / `scheduleWithFixedDelay` | Wall clock changes move nothing. |
| A cron or `scheduleAt` wait of the whole delay | timers of at most a day; the wait ends within a day of the wall clock passing its time | JavaScript timers cannot wait 25 days. |
| A returned `CompletableFuture` not awaited; a reactive result awaited with `fixedDelay` only | a returned `Future` is awaited with every kind, so a slow run delays the next instead of overlapping it | One event loop. |
| `#k` in the day of week accepts large ordinals that never match | `#k` takes 1-5 | |
| Several `TaskScheduler` beans without a primary: a local single-threaded scheduler | the start fails | Explicit. |
| `await-termination` with `close()` | with `closeAsync()` only; a run going on is never interrupted | Dart cannot wait in a synchronous call. |
| `@Async` on any bean method with `@EnableAsync` | on `@EventListener` methods only, switched on by the `TaskExecutor` bean | |
| `spring.task.scheduling.pool.*`, `spring.task.execution.*` | not read | No threads. |
| `ErrorHandler` set on the scheduler | the `ErrorHandler` bean, found by type | |

## Not supported yet

- `SchedulingConfigurer` and `ScheduledTaskRegistrar`.
- Scheduling of prototype beans (ignored with a warning).
- Time zones other than local and UTC.

## See also

- [Overview](index.md)
- [All properties](properties.md)
- [@Scheduled](scheduled.md)
