I have an MVC enabled application that has a single dispactcher servlet with it's springapp-servlet.xml configuration file.
I am trying to get my head around the syntax I hear people use. For instance does this single servlet along with it's xml cfg file amount to what people call a context? I assume I can have more than one dispatcher servlet with an accompanying cfg file so in that case is that an application with multiple contexts?
Basically I'm trying to understand web applications from a high level before really getting into the nuts and bolts of the business logic and navigation, requests, responses etc
james frain wrote:I have an MVC enabled application that has a single dispactcher servlet with it's springapp-servlet.xml configuration file.
I am trying to get my head around the syntax I hear people use. For instance does this single servlet along with it's xml cfg file amount to what people call a context? I assume I can have more than one dispatcher servlet with an accompanying cfg file so in that case is that an application with multiple contexts?
Basically I'm trying to understand web applications from a high level before really getting into the nuts and bolts of the business logic and navigation, requests, responses etc
Yes, you can have multiple contexts. And in the case of Spring MVC, you want two contexts. One for just the web layer beans and one for the middle tier services/repositories. The middle tier one becomes the Parent context of the Web Layer's child context. Which means the child context can see any beans in the parent context. but the parent context cannot see the child context. You want to inject Services into your Controllers, but you definitely never want to inject a Controller into a Service. Call down the stack not up.