OverrideManager
Enables overriding of services registered with the container.
Functions
clear()
Clear active service overrides.
delete(target, qualifier=None)
Clear active override for the target
service.
service(target, new, qualifier=None)
Override the target
service with new
for the duration of the context manager.
Subsequent autowire calls to target
will result in new
being injected.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
target |
type
|
The target service to override. |
required |
qualifier |
Qualifier | None
|
The qualifier of the service to override. Set this if service is registered with the qualifier parameter set to a value. |
None
|
new |
Any
|
The new object to be injected instead of |
required |
services(overrides)
Override a number of services with new for the duration of the context manager.
set(target, new, qualifier=None)
Override the target
service with new
.
Subsequent autowire calls to target
will result in new
being injected.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
target |
type
|
The target service to override. |
required |
qualifier |
Qualifier | None
|
The qualifier of the service to override. Set this if service is registered with the qualifier parameter set to a value. |
None
|
new |
Any
|
The new object to be injected instead of |
required |