简体   繁体   中英

How to read application.properties from POM.xml

I'm not able to find out if it is possible to read any data in Spring's application.properties in the pom.xml file.

In my application-dev.properties file, I have an attribute:

google.project.id = 123456789

In my application-test.properties file, I have an attribute:

google.project.id = 987654321

In my application.properties file, I have an attribute. At one point I set it up for DEV at another time for TEST :

spring.profiles.active=dev 

In my pom.xml file, I would like to read this project id according to the configuration in the spring.profiles.active attribute:

<configuration>
  <projectId> PROJECT ID ???</projectId>
  <version>1</version>
</configuration>

Please, could someone help me?

Thank you.

POM.xml is part of maven project build and has nothing to do with spring.

Spring framework has no idea about pom file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM