How to declare and use dependencies beyond de used framework (in the domain layer) #86
Replies: 1 comment 2 replies
-
svcs can do that for you too. If you want to use those dependencies outside the web framework in a web framework-agnostic way, simply a svcs container into your biz logic. Your biz logic would therefore do classic service location. I personally am not a fan of that: I tend to acquire the services I need in the web layer and pass the instances into my biz logic (which makes it dependency injection) to decouple my business code from dependency management. But it’s up to you, what way you prefer. I’m currently traveling and on a phone, so I can’t type you up an example, but I talk about these things quite a bit in my first two YouTube videos:
|
Beta Was this translation helpful? Give feedback.
-
Hello there!
We are building our application over Fast-api, for the external communication. However, we're applying Hexagonal Architecture, and we are developing some classes in our domain layer. This domain should be agnostic from the used framework, and we have domain classes that depend on other domain classes.
Here is where I become confused about how to use svcs, since all the samples relies on the framework. I come from other languages and frameworks, such as Java and Spring, and here Spring manages all the dependency tree from the app booting.
Do svcs allow this kind of services/dependencies management? How? Could I have any example?
Thanks for you help!
Beta Was this translation helpful? Give feedback.
All reactions