6

I have a webapp that uses SpringMVC DispatcherServlet to load a WebApplicationContext. The Spring reference documentation says:

"each DispatcherServlet has its own WebApplicationContext, which inherits all the beans already defined in the root WebApplicationContext. These inherited beans can be overridden in the servlet-specific scope, and you can define new scope-specific beans local to a given servlet instance.

But where do I put this root WebApplicationContext?

1 Answer 1

9

We have applicationContext.xml in theWEB-INF directory, and the beans in that config are available to the spring-servlet.xml config, its defined using

<context-param> <param-name>contextConfigLocation</param-name> <param-value>/WEB-INF/applicationContext.xml</param-value> </context-param> 

By the way its the ContextLoaderListener which is responsible for managing the root context

<listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.