[英]How to correct use SpEL in XML Spring
我想使用静态方法使用资源将util bean创建为图像
ClassLoader.getSystemResource
并且
File.separator
她是我的效用资源图
<util:map id="ImageFiles" key-type="java.lang.String" value-type="java.lang.String" >
<entry key="success" value="#{ClassLoader.getSystemResource("icons"+File.separator+"png"+File.separator+"24x24"+File.separator+"OK.png")}" />
<entry key="error" value="OptionPane.errorIcon" />
<entry key="info" value="OptionPane.informationIcon" />
</util:map>
但是我在Xml中解析语法错误。 可以这样做吗?
要使用SpEL的静态方法,您应该学习有关最后一个方法的更多信息:
<entry key="success" value="#{T(com.my.proj.pack.ClassLoader).getSystemResource("icons"+File.separator+"png"+File.separator+"24x24"+File.separator+"OK.png")}" />
确切地说,是怎么说的? 示例如下:
<util:map id="nameToPeriod">
<entry key="${validation.cycle.units.representation.month}" value="#{T(org.joda.time.Months).ONE}" />
<entry key="${validation.cycle.units.representation.day}" value="#{T(org.joda.time.Days).ONE}" />
<entry key="${validation.cycle.units.representation.hour}" value="#{T(org.joda.time.Hours).ONE}" />
<entry key="${validation.cycle.units.representation.week}" value="#{T(org.joda.time.Weeks).ONE}" />
</util:map>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.