Summary of configuration functions such as web.xml context-param

#### 1. The role of context-param:
1) When starting a WEB project, the container (such as Tomcat) will read the two nodes in the configuration file web.xml and

2) Next, the container creates a "ServletContext" object, which is shared by the entire web project

3) The container will be converted into a key-value pair and handed over to the ServletContext

4) The container creates a listener object, that is, creates a listener

5) There will be a contextInitialized(ServletContextEvent args) initialization method in the monitor, in which ServletContext = ServletContextEvent.getServletContext();
context-param value = ServletContext.getInitParameter("context-param key");

Note:
1. Therefore, the database link configuration, Hibernate\quartz and other configuration files are placed in [Can it be placed in the init-param in the Dispacter? Guess: yes

  1. Read it to find the corresponding configuration file, and then generate the Root web application context
  2. Read the Dispatcher-servlet, of course, read the configuration file, and then generate the context corresponding to the Dispacth-servlet.xml configuration file

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325655694&siteId=291194637