Repository navigation
Conversation
winter.messaging's EventDispatcher, winter.ddd's DomainEventDispatcher and the repositories of winter.sqlalchemy take the injector that creates them instead of winter.application.get_injector, so set_injector and get_injector are gone and nothing in Winter is process-global behaviour. DomainEventDispatcher(injector) creates the handlers with that injector. The tests share the injector of the sample application from tests/injection.py. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #352.
What
winter.application.set_injectorandget_injectorare gone.winter.messaging.EventDispatcher,winter.ddd.DomainEventDispatcherand the repository implementation ofwinter.sqlalchemydeclareinjector: Injectorin their@injectconstructors and use it to create handlers or call the constructors of repository subclasses. An injector injects itself, a child injector the child, so each gets the injector that created it.DomainEventDispatcherwas created by hand,DomainEventDispatcher(); it isDomainEventDispatcher(injector)now, or created by the injector.tests/injection.pyinstead of installing it globally inconftest.py; the messaging and ddd tests use injectors of their own.docs/architecture.md: the last deviation from principle 2 is gone.Why
These three call sites were the last process-global behaviour of Winter: a service locator, in classes that the injector creates anyway.
To be confirmed on the consumer: where it calls
set_injector,get_injectororDomainEventDispatcher().🤖 Generated with Claude Code