Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ class SimpleFactory:

@dataclasses.dataclass(kw_only=True, slots=True)
class DependentFactory:
simple_factory: SimpleFactory
singleton: str
```

Expand Down Expand Up @@ -99,7 +100,7 @@ For now there are integrations for the following frameworks:

Create a container and resolve dependencies in your code
```python
from modern_di import Container
from modern_di import Container, Scope


ALL_GROUPS = [Dependencies]
Expand All @@ -123,8 +124,8 @@ try:
finally:
# Close container when done
# For async usage:
# await request_container.close_async()
await request_container.close_async()

# For sync usage:
# request_container.close_sync()
request_container.close_sync()
```
1 change: 1 addition & 0 deletions packages/modern-di-faststream/modern_di_faststream/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ def setup_di(

container.providers_registry.add_providers(faststream_message=faststream_message)
app.context.set_global("di_container", container)
app.after_shutdown(container.close_async)
app.broker.add_middleware(_DIMiddlewareFactory(container))
return container

Expand Down