|
此版本仍在开发中,目前尚不被视为稳定版本。如需最新稳定版本,请使用 Spring Cloud Commons 5.0.1! |
缓存随机属性源
Spring Cloud Context 提供了一个 PropertySource,该组件根据键缓存随机值。除了缓存功能外,其工作方式与 Spring Boot 的 RandomValuePropertySource 完全相同。此随机值在需要一个即使在 Spring 应用上下文重启后仍保持一致的随机值时非常有用。该属性值的格式为 cachedrandom.[yourkey].[type],其中 yourkey 是缓存中的键。type 值可以是 Spring Boot 的 RandomValuePropertySource 所支持的任意类型。
myrandom=${cachedrandom.appname.value}