Runtime dependency injection with Spring

前端 未结 3 668
我寻月下人不归
我寻月下人不归 2020-12-14 21:24

My current project is leveraging Spring, and our architect has decided to let Spring manage Services, Repositories and Factory objects, but NOT domain objects. We are closel

3条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-14 21:49

    Spring's dependency injection (and dependency injection in general) is basically for wiring together Services, Repositories and Factories, etc. It's not supposed to directly handle things that need to be done dynamically in response to commands, etc., which includes most stuff with domain objects. Instead, it provides control over how those things are done by allowing you to wire in the objects you want to use to do them.

提交回复
热议问题