请使用 Spring Cloud Commons 5.0.1 获取最新稳定版本!spring-doc.cadn.net.cn

缓存随机属性源

Spring Cloud Context 提供了一个 PropertySource,该组件根据键缓存随机值。除了缓存功能外,其工作方式与 Spring Boot 的 RandomValuePropertySource 完全相同。此随机值在需要一个即使在 Spring 应用上下文重启后仍保持一致的随机值时非常有用。该属性值的格式为 cachedrandom.[yourkey].[type],其中 yourkey 是缓存中的键。type 值可以是 Spring Boot 的 RandomValuePropertySource 所支持的任意类型。spring-doc.cadn.net.cn

myrandom=${cachedrandom.appname.value}