![](/img/trans.png)
[英]Spring Boot - property could not be resolved in xml from application.properties
[英]property value not resolved from application.properties using spring boot
我使用這個配置
應用程序屬性
user.name.auth=s-SGH-S0007
@Value("${user.name.auth}")
private String userNameAuth;
當我嘗試從給定屬性中獲取值時,會出現錯誤。
嵌套異常是 java.lang.IllegalArgumentException:無法解析值“$ {user.name.auth}”中的占位符“user.name.auth”
我怎樣才能解決這個錯誤(不使用 yaml)?
就我而言,因為我正在運行集成測試,並且屬性的值僅在應用程序中指定。 應用程序的屬性,所以我得到了一個錯誤。 如果入口點在測試循環中,那么有必要在 application.properties 中定義所需的屬性。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.