Spring root WebApplicationContext for Servlet

后端 未结 1 1384
太阳男子
太阳男子 2021-01-13 06:04

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

\"each DispatcherServ

相关标签:
1条回答
  • 2021-01-13 06:55

    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>
    
    0 讨论(0)
提交回复
热议问题