Spring Boot application.properties扩展了另一个属性文件 [英] Spring boot application.properties extends another property file
问题描述
我要继承到应用程序属性的一个属性文件中的属性很少.请告知在春季启动时是否可行.
I have few properties in one property file which I want to inherit to application properties. Please let know if that is possible in spring boot.
类似
application.properties
----------------------
extends = otherproperty.properties
property1 = value1
property2= value2
property3 = value3
otherproperty.properties
------------------------
property4=value4
property5 = value5
当Spring Boot应用程序加载时,我希望所有5个属性都应加载并可以使用@Value注释使用.弹簧启动会自动在类路径中选择application.properties,而我没有applicaitoncontext xml或任何属性加载器代码.
When the spring boot app loads, I want all 5 properties should be loaded and available using @Value annotation. The spring boot automatically picks the application.properties in classpath and I don't have applicaitoncontext xml or any property loader code.
谢谢.
推荐答案
对我来说,application.properties
文件中的spring.profiles.include=p1,p2,p3
工作
For me works spring.profiles.include=p1,p2,p3
in application.properties
file
这篇关于Spring Boot application.properties扩展了另一个属性文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!