Package org.springframework.scheduling

# Interface Trigger

All Known Implementing Classes:
  `CronTrigger`, `PeriodicTrigger`

public interface Trigger
Common interface for trigger objects that determine the next execution time of a task that they get associated with.

Since:
  3.0
Author:
  Juergen Hoeller
See Also:
  - `TaskScheduler.schedule(Runnable, Trigger)`
  - `CronTrigger`

## Method Summary

Modifier and Type
Method
Description
`Instant`
`nextExecution(TriggerContext triggerContext)`
Determine the next execution time according to the given trigger context.
`default Date`
`nextExecutionTime(TriggerContext triggerContext)`
Deprecated.
as of 6.0, in favor of `nextExecution(TriggerContext)`

## Method Details

### nextExecutionTime

@Deprecated(since="6.0") @Nullable default Date nextExecutionTime(TriggerContext triggerContext)
Deprecated.
as of 6.0, in favor of `nextExecution(TriggerContext)`
Determine the next execution time according to the given trigger context.

The default implementation delegates to `nextExecution(TriggerContext)`.

Parameters:
  `triggerContext` - context object encapsulating last execution times and last completion time
Returns:
  the next execution time as defined by the trigger, or `null` if the trigger won't fire anymore

### nextExecution

@Nullable Instant nextExecution(TriggerContext triggerContext)
Determine the next execution time according to the given trigger context.

Parameters:
  `triggerContext` - context object encapsulating last execution times and last completion time
Returns:
  the next execution time as defined by the trigger, or `null` if the trigger won't fire anymore
Since:
  6.0