How to set the loading path for the configuration file in web. xml
How to set the configuration file loading path instance in web. xml
When a web application is started through a Tomcat or other container, the web application is first loaded. xml files. Generally, various configuration files in our project, such as logs, databases, and spring files, are loaded at this time. Below are two common configuration file loading paths, that is, the configuration file can be placed in the SRC directory or in the WEB-INF root directory.
The first type is configured in web. xml as follows:
<Context-param> <param-name> contextConfigLocation </param-name> <param-value> classpath: config/XXXXXXX. xml </param-value> </context-param>
Indicates that there is a folder named config under the class path.
The second type is configured in web. xml as follows:
<Context-param> <param-name> contextConfigLocation </param-name> <param-value>/WEB-INF/config/*-context. xml </param-value> </context-param>
In the config folder, wildcards are used. The two methods have the same functions.
Thank you for reading this article. I hope it will help you. Thank you for your support for this site!