Scopes allow late-binding of values to step/job-scoped components at execution time.
| Class | Namespace |
|---|---|
AbstractScope |
Lemric\BatchProcessing\Scope |
JobScope |
Lemric\BatchProcessing\Scope |
StepScope |
Lemric\BatchProcessing\Scope |
A scoped container resolves and caches scoped beans for the lifetime of a single execution:
| Class | Namespace |
|---|---|
ScopedContainerInterface |
Lemric\BatchProcessing\Scope\Container |
InMemoryScopedContainer |
Lemric\BatchProcessing\Scope\Container |
Late-binding expressions reference job parameters or execution context values:
| Class | Namespace |
|---|---|
LateBindingExpressionResolverInterface |
Lemric\BatchProcessing\Scope\Expression |
SimpleLateBindingExpressionResolver |
Lemric\BatchProcessing\Scope\Expression |
The simple resolver supports placeholders that reference parameters / context values; refer to the class for the exact syntax supported in your version.
| Attribute | Purpose |
|---|---|
Lemric\BatchProcessing\Attribute\JobScope |
Marks a class as JobScope |
Lemric\BatchProcessing\Attribute\StepScope |
Marks a class as StepScope |
Lemric\BatchProcessing\Attribute\Listener\* |
Listener attribute markers |
use Lemric\BatchProcessing\Attribute\StepScope;
#[StepScope]
final class PartitionAwareReader implements ItemReaderInterface
{
public function __construct(
private readonly int $minValue,
private readonly int $maxValue,
) {}
public function read(): mixed { /* ... */ }
}- Activation — when a Job/Step starts, its scope is activated and a fresh
ScopedContaineris bound. - Resolution — scoped beans are resolved (or rebuilt) on first access from inside the active scope.
- Deactivation — when the Job/Step ends, the scope is deactivated and resolved beans are released.
Accessing a scoped bean outside its active scope throws
Lemric\BatchProcessing\Exception\ScopeNotActiveException.
Lemric\BatchProcessing\Listener\ScopeResetListener clears the scoped
container between runs to avoid leaking state across executions.