Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

5
  • What a complete and detailed explanation @candied_orange, Thank you very much for that. I'll have to read it carefully more than once because I'm exhausted today, but I appreciate your time. I'll wait a little to see if more answers arrive before marking it as correct :) Commented Jul 22, 2022 at 16:49
  • BTW @candied_orange, and talking about DI, should I always inject an Interface instead of the actual class? Commented Jul 22, 2022 at 17:13
  • That's worthy of it's own question. Commented Jul 22, 2022 at 17:16
  • I have read your answer again and it is just a great answer @candied_orange. Thanks again for your time, and I'll ask the one regarding interfaces in another question. Commented Jul 22, 2022 at 19:14
  • Given your answer @candied_orange, I'll use my ExceptionHandler (given in the example) as a static class and AppSettings (with context + singleton database + app configuration) as Hilt ApplicationClass. I also guess Repository should be injected, because functions could change, the same for services. I understand that using DI or static classes depend on the context, and can be mixed in a project with no problems, I understand that if you use DI, this doesn't mean all your classes must be injected. One last thing, could you edit my post with a possible solution to the problem I describe.Thanks Commented Jul 22, 2022 at 19:21