重复的属性值 [英] Duplicate property value

查看:44
本文介绍了重复的属性值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以复制属性的值(无需复制和粘贴)?无论如何要标记它,以便我可以为属性 baz 重用 foo 的值?

Is it possible to duplicate the value (without having to copy and paste) of a property? Is there anyway to mark it such that I could reuse the value of foo for the property baz?

foo=bar
baz=bar

我们有可以出现在许多页面上的通用信息.如果能够使用公共信息创建一个属性,然后在另一个属性中使用此值来帮助我们保持 DRY,那就太好了.

We have common pieces of information which can appear on many pages. It'd be nice to be able to create one property with the common information, and then use this value in another property to help us keep DRY.

推荐答案

直接 - 没有.如果您通过后处理器传递属性 - 是的.例如 spring 的 <context:property-placeholder-configurer/> 解析 ${placeholder} 语法并用适当的值替换它.

Directly - no. If you pass the properties through a post-processor - yes. For example spring's <context:property-placeholder-configurer /> parses ${placeholder} syntax and replaces it with the proper value.

这篇关于重复的属性值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆