Why is Spring's ApplicationContext.getBean considered bad?

前端 未结 14 1810
一整个雨季
一整个雨季 2020-11-22 14:33

I asked a general Spring question: Auto-cast Spring Beans and had multiple people respond that calling Spring\'s ApplicationContext.getBean() should be avoided

14条回答
  •  清酒与你
    2020-11-22 15:21

    One of Spring premises is avoid coupling. Define and use Interfaces, DI, AOP and avoid using ApplicationContext.getBean() :-)

提交回复
热议问题