In every project that integrates the spring framework, it is always inevitable to be on the web Add such a configuration in XML.
contextConfigLocation
classpath:spring-config.xml
org.springframework.web.context.ContextLoaderListener
The function of contextloaderlistener is to read the XML file defined in contextconfiglocation when starting the web container, automatically assemble the configuration information of ApplicationContext and generate webapplicationcontext objects
Then place this object in the attribute of ServletContext, so that as long as we get the servlet, we can get the webapplicationcontext object, and use this object to access the beans managed by the spring container
Simply put, the above configuration provides spring support for the project and initializes the IOC container