Skip to content

Is it possible to inject one application service into another application service #15343

Answered by EngincanV
rajasingh012 asked this question in Q&A
Discussion options

You must be logged in to vote

Yes, it's possible but I would not suggest it, instead use the domain layer for the required task (for example repositories).

Let me share a quote from Application Services Best Practices & Conventions document:

Do not use other application services of the same module/application. Instead;

  • Use domain layer to perform the required task.
  • Extract a new class and share between the application services to accomplish the code reuse when necessary. But be careful to don't couple two use cases. They may seem similar at the beginning, but may evolve to different directions by time. So, use code sharing carefully.

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@rajasingh012
Comment options

@EngincanV
Comment options

Answer selected by rajasingh012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants