How to set the loading path of the configuration file in detail
When a web application is started through containers such as Tomcat, the file will be loaded first. Usually, various configuration files in our project, such as logs, databases, spring files, etc., are loaded at this time. The following are two commonly used configuration file loading paths, that is, the configuration files can be placed in the SRC directory or in the WEB-INF root directory.
The first type is configured like this:
<context-param> <param-name >contextConfigLocation </param-name > <param-value >classpath:config/ </param-value > </ context-param>
Indicates that there is a folder named config under the classpath
The second configuration is as follows:
<context-param> <param-name >contextConfigLocation </param-name > <param-value >/WEB-INF/config/*- </param-value > </ context-param>
Put it in the config folder and use wildcard characters. The functions of the two methods are the same, which depends on your personal preference.
Thank you for reading, I hope it can help you. Thank you for your support for this site!