CachedRandomPropertySource

Spring Cloud Context 提供了一個 PropertySource,它根據鍵快取隨機值。除了快取功能,它的工作方式與 Spring Boot 的 RandomValuePropertySource 相同。這種隨機值在您需要一個在 Spring 應用程式上下文重啟後仍然一致的隨機值時可能很有用。屬性值採用 cachedrandom.[yourkey].[type] 的形式,其中 yourkey 是快取中的鍵。type 值可以是 Spring Boot 的 RandomValuePropertySource 支援的任何型別。

myrandom=${cachedrandom.appname.value}
© . This site is unofficial and not affiliated with VMware.