Search code examples
springweb-applicationsapplicationcontext

Application context and spring context is same?


I am new to spring MVC,and just started working on it.I would like to know about the application context(web-applicationcontext) and the context provided by the spring i.e spring-servlet.xml whether it is same or different.

Hopefully somebody could give me the greater idea to come over this confusion.


Solution

  • The difference between the application context and servlet context is that whatever is specified in the application context can be referenced in the servlet context, but not vice-versa.

    That's to say that you can have components that are reused through your servlets specified at the application context level, but certain things that are only specific to a certain servlet can be specified there to isolate them from the application and other servlets.

    That's there if you have a need for fine-grained control.