我想在 .properties
文件中设置一个属性。它应该引用另一个包或项目。我正在使用 spring/spring boot
例如:
some_file: ${another_package_name}/src/main/resources/some_file.txt
最佳答案
你说 ${another_package_name} 的地方是项目将用于 gradle 或 maven 项目的地方,所以我假设你正在尝试在项目之间交叉引用资源。
位置
${another_package_name}/src/main/resources/some_file.txt
也可以叫
classpath:some_file.txt
那么您只需要确保两个项目都在类路径上,然后 some_file.txt 应该对整个项目可用。
引用
http://docs.spring.io/autorepo/docs/spring/3.2.x/spring-framework-reference/html/resources.html
关于java - 如何在 .properties 文件中引用另一个项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33329389/