-
- Notifications
You must be signed in to change notification settings - Fork 340
Closed
Description
App Package (Container) Diagramm
The CoreContainer container contains:
class CoreContainer( containers.DeclarativeContainer ): arguments = providers.Resource( parse_arguments ) config = providers.Resource( parse_config, arguments=arguments ) _logging = providers.Resource( init_logging, arguments=arguments, config=config ) logger_factory = providers.Factory( logging.getLogger ).providerThe main question is about CoreContainer. Is there a way to make it
share for the entire application? The only way I found is when
importing top-level containers (CleanContainer, DatabaseInitContainer,
ParseContainer, ...) specify the CoreContainer container as a
dependency and pass it into the chuld containers.
If I do this:
class DatabaseContainer( containers.DeclarativeContainer ): core: CoreContainer = providers.Container( CoreContainer ) ... class DownloadContainer( containers.DeclarativeContainer ): core: CoreContainer = providers.Container( CoreContainer ) ... class ParseContainer( containers.DeclarativeContainer ): core: CoreContainer = providers.Container( CoreContainer )then all elements in CoreContainer are initialized multiple times.
It was it would be convenient if the container itself was like a
Singletone for the entire application.
Metadata
Metadata
Assignees
Labels
No labels