How can I create and get multiple IoC container instances in web application?
And in web application, there are 2 types of Spring containers - one is application context ApplicationContext
and another is WebApplicationContext
, I know I could have multiple WebApplicationContext
if I declare multiple servlets using org.springframework.web.servlet.DispatcherServlet
, so suppose I have 3 such DispatcherServlet
configuration and then one is global one (using context-param
), so does it mean that it would have 4 IoC containers?
And how can I get the object of those IoC container?
I have read lot of SO questions related to application context but it is driving me crazy, things are clear for application context created using ClassPathXmlApplicationContext
but in case of web i.e. ApplicationContext
and WebApplicationContext
, things are not at clear.
Please note that I have read this link but it is for ClassPathXmlApplicationContext
, but my all confusion is for application context w.r.t. to web applications.
P.S.: There is really not any purpose for why I want to do this, I am in learning phase so I am trying to understand containers.