[英]How to set spring property to a null value from an environment variable
Spring 屬性可以從環境變量中綁定: https://docs.spring.io/spring-boot/docs/current.relaxed-typesafe-configuration-properties/current.relaxed-typesafe-configuration-configuration-configuration- 。環境變量
I've tried various forms of null
, NULL
, #{null}
but always end up with failed to convert java.lang.String to java.time.Duration (caused by java.lang.IllegalArgumentException: 'null' is not a valid duration)
如何從環境變量中設置null
值?
您不能從環境變量(或任何其他屬性源)設置 null 值。 此 Spring 引導問題正在跟蹤添加對綁定null
值的支持。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.