Usage patterns / use cases for DI or when to use it

I am not sure which use cases should be used in the application. I know that injection services, such as PlaceServiceor CalculationServiceetc., are very well suited, but I must also create my domain objects using DI how User? What is it if it Userhas only one constructor, which requires the first and last name. Is this allowed with DI?

Should I use DI to create instances for Set / List interfaces or is this pure overflow?

I use mainly.

+3
source share
2 answers

, , , , , , / , .

, , , , , , , .. , Salve .

Guice , , User, AssistedInject, - .

+2

ig0774 . , :

Domain-Driven Design DI , .

, DI , .

+4

Source: https://habr.com/ru/post/1750600/


All Articles