How do idea tomcat deployment projects choose profile issues?

when deploying a web project in multiple environments, you can set the packaged configuration file by specifying mvn package -Pdev , but how do you specify which environment configuration file to use when deploying the service directly with tomcat?
the configuration structure of the project is as follows:


tomcat

it turns out that configuration files under dev are used when deploying directly with tomcat, but why?
as set in the second figure above, the path to the configuration file is props/ .properties , while the directory structure of the configuration file after deployment is the structure of the third figure. There is no properties file directly under the props directory. So why are you reading the configuration file of props/dev/.properties ? Not prd or test?
by the way: when deployed through tomcat, pom.xml should not be performed, is it? Won"t walk the life cycle of pom?

Mar.12,2021

  • if it is SpringBoot, you can specify which environment configuration file to use in the startup parameters.
  • if it is a traditional Spring application, it is also recommended to manually specify the external configuration file when starting Tomcat. Such as -Ddbpro=/xx/xx/db.properties , and then load it in the configuration file using < property name= "location" value= "${appprop}" / > .
  • if it is a distributed application, it is recommended to use the configuration center to decouple and uniformly manage the configuration.
Menu