[英]spring boot is not reading correct property according profile
我的Spring Boot應用程序是使用以下參數從命令行啟動的
--spring.profiles.active = dev
資源文件夾中有兩個屬性文件:
application.properties
application_dev.properties
在我的應用程序中,我有一個Spring Component,它使用以下內容從屬性文件讀取
@Value(“ $ {ch.admin.host}”)
私有字符串remoteHost;
問題是默認屬性文件(application.properties)的值分配給變量remoteHost,而不是屬性文件application_dev.properties的值
您應該將文件更改為application-dev.properties。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.