The configuration file (properties or yml) in the project is separated from the project. Common configuration methods are as follows:
<profiles> <profile> <id>mas</id> <activation> <activeByDefault>true</activeByDefault> </activation> <properties> <maven.properties.mas_properties_path>file:/opt/pay/config/mas/mas_v2.properties</maven.properties.mas_properties_path> </properties> </profile> <profile> <id>mas4pos</id> <properties> <maven.properties.mas_properties_path>file:/opt/pay/config/pos/mas4pos/mas_v2.properties</maven.properties.mas_properties_path> </properties> </profile> </profiles>
The path to the specified configuration file is:
file:/opt/pay/config/mas/mas_v2.properties
If it is a linux system, it is easy to understand, / is the root directory, just look for /opt/pay/config/mas/mas_v2.properties
If it is a window system, the configuration of this absolute path is as follows:
- If it is an embedded tomcat startup or a springBoot startup method, the root directory represented by / is the root directory of the project project (for example, the project directory is: D:\workspace\mas, then the configuration file: D:\opt\pay\config\ mas\...)
- If it is started after publishing through tomcat, the root directory represented by / is the root directory where tomcat is located (for example, the project directory is: D:\workspace\mas, and the directory where Tomcat is located is C:\tomcat7, the configuration file is based on the directory where tomcat is located: C :\opt\pay\config\mas\...)
It is strictly forbidden to specify the absolute path of the window in the configuration, that is, use / to represent the root directory