Evaluating properties inside Spring Expression Lang (SpEL)

╄→гoц情女王★ 提交于 2019-12-05 09:35:53

"#{T(java.util.concurrent.TimeUnit).MINUTES.toMillis( @configurationProperties['garbageLevelWatcher.refreshIntervalMinutes'])}"

EDIT:

Or...

<context:property-placeholder properties-ref="configurationProperties"
<util:constant id = "MINUTES" static-field="java.util.concurrent.TimeUnit.MINUTES" />

and

"#{@MINUTES.toMillis(${garbageLevelWatcher.refreshIntervalMinutes})}"

If the properties are looked up by a PropertyPlaceholderConfigurer, @PropertySource or <context:property-placeholder /> and the context is aware of it

You can write it like this:

p:repeatInterval="#{ 1000 * 60 * T(java.lang.Integer).valueOf('${garbageLevelWatcher.refreshIntervalMinutes}') }"
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!