[英]External YAML property file and normal properties file in Spring Boot
這是我設置外部配置文件的方式:
/** for .yaml file
@Configuration
@PropertySource("classpath:waterlvl.yaml")
@ConfigurationProperties("Alerts")
public class WaterLvlAlertConfig {
/** for .properties file
@Component
@PropertySource("classpath:waterlvl.properties")
public class WaterLvlConfig {
屬性沒有被提取,我的文件位於資源文件中。 我認為我提供的路徑是錯誤的。 我究竟做錯了什么?
在春季啟動中,使用.yaml配置時無法使用@PropertySource。 請參閱外部化配置文檔中的點24.6.4 YAML缺點。 另外,前面已經回答了類似的問題,請參考-Spring Boot屬性文件的外部配置
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.