ApplicationContext and ServletContext

前端 未结 5 597
孤独总比滥情好
孤独总比滥情好 2020-12-23 09:55

I get confused between the two ApplicationContext and ServletContext when it comes to Spring MVC Application. I know that There is just only One ApplicationContext per Sprin

5条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-23 10:27

    ApplicationContext is Spring's container.

    It's used to wire the configurations from Spring beans together and use them for the application.

    Use ApplicationContext if you want to retrieve the information of Spring beans.

    Use ServletContext if you want to get/set attribute those shared to all Servlet.

提交回复
热议问题