![](/img/trans.png)
[英]How to load external properties file through OSGi blueprint property-placeholder and Java DSL
[英]How to load an external property file and load the values to another properties file
我想加载一个外部属性文件并将其值设置为另一个属性文件,这可能吗? 例如:
C:\\ properties \\ file.properties
id =用户ID
密码=通过
./main/resources/application.properties
user.id = $ {id}
user.password = $ {密码}
我执行了以下命令,但无法正常工作
java -jar -Dspring.config.location=C:/properties/file.properties java-1.0-SNAPSHOT.jar
exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'id' in value "${id}"
您可以在Spring Boot库中使用@PropertySource批注。 文档和示例: https : //docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/context/annotation/PropertySource.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.