This commit is contained in:
Sven Heidemann 2021-03-29 12:16:12 +02:00
parent 30ef74dd18
commit 41ddc86961
2 changed files with 7 additions and 8 deletions

View File

@ -13,14 +13,14 @@ class StartupTemplate(TemplateFileABC):
self._value = textwrap.dedent("""\
from cpl.application import StartupABC
from cpl.configuration import ConfigurationABC
from cpl.dependency_injection import ServiceProviderABC
from cpl.dependency_injection import ServiceProviderABC, ServiceCollectionABC
class Startup(StartupABC):
def __init__(self, config: ConfigurationABC, services: ServiceProviderABC):
def __init__(self, config: ConfigurationABC, services: ServiceCollectionABC):
StartupABC.__init__(self)
self._configuration = config
self._environment = self._configuration.environment
self._services = services
@ -29,8 +29,7 @@ class StartupTemplate(TemplateFileABC):
return self._configuration
def configure_services(self) -> ServiceProviderABC:
return self._services
return self._services.build_service_provider()
""")
@property

View File

@ -1,11 +1,11 @@
from cpl.application import StartupABC
from cpl.configuration import ConfigurationABC
from cpl.dependency_injection import ServiceProviderABC
from cpl.dependency_injection import ServiceProviderABC, ServiceCollectionABC
class Startup(StartupABC):
def __init__(self, config: ConfigurationABC, services: ServiceProviderABC):
def __init__(self, config: ConfigurationABC, services: ServiceCollectionABC):
StartupABC.__init__(self)
self._configuration = config
@ -16,5 +16,5 @@ class Startup(StartupABC):
return self._configuration
def configure_services(self) -> ServiceProviderABC:
return self._services
return self._services.build_service_provider()