You may use dependency hooks to modify the instances when they are requested from the container. Hooks can modify the properties of the dependency, or even replace the instance with another one.
@Service
class MyService {
private int value = 5;
}
void useHooks() {
Container.addHook("MY_HOOK", (service, container) -> {
// override the default value of `5` to `10`
service.value = 10;
return service;
});
MyService service = Container.get(MyService.class);
assert service.value == 10;
}