英文:
How to read application.properties from POM.xml
问题
我无法确定是否可以在pom.xml文件中读取Spring的application.properties中的任何数据。
在我的application-dev.properties文件中,我有一个属性:
google.project.id = 123456789
在我的application-test.properties文件中,我有一个属性:
google.project.id = 987654321
在我的application.properties文件中,我有一个属性。在某一时刻,我将其设置为DEV,在另一时刻设置为TEST:
spring.profiles.active=dev
在我的pom.xml文件中,我想根据spring.profiles.active属性的配置来读取此项目ID:
<configuration>
<projectId>项目ID ???</projectId>
<version>1</version>
</configuration>
请问有人能帮我吗?
谢谢。
英文:
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.
答案1
得分: 3
POM.xml是Maven项目构建的一部分,与Spring无关。
Spring框架不了解pom文件。
英文:
POM.xml is part of maven project build and has nothing to do with spring.
Spring framework has no idea about pom file.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论