In an application using the DDD concepts, I am in doubt about who could inject (dependencies) in a particular class, if there is any standard for this.
It is as follows, between the Application, Domain and Repository layers.
1) A ClienteAppService(Application layer) that needs to inject user, should i inject UsuarioApplicationService and from it call UsuarioService(Domain) or inject UsuarioService directly into ClienteApplicationService?
2) In ClienteService(domain) should I inject UsuarioService and then call UsuarioRepository or could I inject UsuarioRepository directly into ClienteService?
I get worried about cyclic referencing if I keep injecting peer classes.
But I also think that I shouldn't inject another Entity's Repository, because many times the repository's methods have a rule in the service that must be called beforehand.
Has anyone had this question, how do you usually treat it?
At the beginning of your text you ask "Who" could inject the dependency into a class.
Dependency injection is the role of the dependency injection infrastructure.
In a dependency graph – "A" depends on "B" – which in turn "B" depends on "C" – which in turn "C" depends on "D" – which in turn "D" depends on "E" – which in turn "E" depends on "F"
All these elements must be injected by the infrastructure. Starting with the creation of F, then E, then D, C, B and finally A.
Circular reference is a problem, avoiding it is necessary.
Boundaries Contexts help limit this dependency on the Boundary Context. You are probably not following this concept regarding DDD.