在hazelcastconfig中通过PropertyPlaceholderConfigurer设置整数值时出现问题

时间:2012-04-11 11:14:59

标签: spring properties hazelcast

我使用带有hazelcast的spring和Spring的PropertyPlaceholderConfigurer将属性插入到spring-xml中,并根据不同的环境进行更改。

e.g:

hz:network port="${hazelcast.port}" port-auto-increment="true"

我希望更改地图的最大空闲秒数(对于每个环境应该是不同的)。但这不会起作用,因为它不会将其识别为整数:

hz:map name="default" backup-count="2" max-size="0"
max-idle-seconds="${hazelcast.maxidleseconds}" />

我尝试运行时遇到此异常:

Caused by: org.xml.sax.SAXParseException: cvc-datatype-valid.1.2.1: '${hazelcast.maxidleseconds}' is not a valid value for 'integer'.

也许PropertyPlaceholderConfigurer无法插入整数。也许这是与hazelcast.xsd相关的问题。

也许这里有人知道解决方案?

tia&&问候   noircc

1 个答案:

答案 0 :(得分:4)

  

修改虽然Hazelcast小组提供了解决方案,但我在此处发布了可见度。

这是一个很久以前修复的旧问题。升级到2.x版本并将xml配置标头更新为:

<beans xmlns="http://www.springframework.org/schema/beans"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xmlns:hz="http://www.hazelcast.com/schema/spring"
   xsi:schemaLocation="http://www.springframework.org/schema/beans
            http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
            http://www.hazelcast.com/schema/spring
            http://www.hazelcast.com/schema/spring/hazelcast-spring-2.0.xsd">

另请查看Hazelcast-Spring integration文档了解详情。