bean class [com.hazelcast.config.Config] 的 属性 'semaphoreConfigs' 无效:
Invalid property 'semaphoreConfigs' of bean class [com.hazelcast.config.Config]:
我正在尝试在我的 spring JUnit 测试中启动一个 hazelcast 实例。下面是我试图加载为@ContextConfiguration
的xml配置
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
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.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.hazelcast.com/schema/spring
http://www.hazelcast.com/schema/spring/hazelcast-spring.xsd">
<context:annotation-config />
<hz:hazelcast id="instance">
<hz:config>
<hz:spring-aware />
<hz:group name="dev" password="password"/>
<hz:network port="5701" port-auto-increment="false">
<hz:join>
<hz:multicast enabled="false" />
<hz:tcp-ip enabled="true">
<hz:members>127.0.0.1</hz:members>
</hz:tcp-ip>
</hz:join>
</hz:network>
</hz:config>
</hz:hazelcast>
我得到下面的异常,任何指针都有帮助
org.springframework.beans.NotWritablePropertyException: Invalid property 'semaphoreConfigs' of bean class [com.hazelcast.config.Config]: Bean property 'semaphoreConfigs' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:1042)
at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:902)
at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:75)
at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:57)
异常描述表明 Spring 3.2.4.RELEASE 由于 getter return 类型和 setter 参数类型之间存在差异而无法处理信号量配置.来自 com.hazelcast.config.Config
class:
public Collection<SemaphoreConfig> getSemaphoreConfigs() {...}
public Config setSemaphoreConfigs(Map<String, SemaphoreConfig> semaphoreConfigs) {...}
hazelcast-spring
是针对 Spring framework 4.3.0.RELEASE and it handles semaphore config creation properly (tested here 构建和测试的。如果可以选择升级 Spring 框架版本,我建议这样做。
我正在尝试在我的 spring JUnit 测试中启动一个 hazelcast 实例。下面是我试图加载为@ContextConfiguration
的xml配置<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
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.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.hazelcast.com/schema/spring
http://www.hazelcast.com/schema/spring/hazelcast-spring.xsd">
<context:annotation-config />
<hz:hazelcast id="instance">
<hz:config>
<hz:spring-aware />
<hz:group name="dev" password="password"/>
<hz:network port="5701" port-auto-increment="false">
<hz:join>
<hz:multicast enabled="false" />
<hz:tcp-ip enabled="true">
<hz:members>127.0.0.1</hz:members>
</hz:tcp-ip>
</hz:join>
</hz:network>
</hz:config>
</hz:hazelcast>
我得到下面的异常,任何指针都有帮助
org.springframework.beans.NotWritablePropertyException: Invalid property 'semaphoreConfigs' of bean class [com.hazelcast.config.Config]: Bean property 'semaphoreConfigs' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter? at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:1042) at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:902) at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:75) at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:57)
异常描述表明 Spring 3.2.4.RELEASE 由于 getter return 类型和 setter 参数类型之间存在差异而无法处理信号量配置.来自 com.hazelcast.config.Config
class:
public Collection<SemaphoreConfig> getSemaphoreConfigs() {...}
public Config setSemaphoreConfigs(Map<String, SemaphoreConfig> semaphoreConfigs) {...}
hazelcast-spring
是针对 Spring framework 4.3.0.RELEASE and it handles semaphore config creation properly (tested here 构建和测试的。如果可以选择升级 Spring 框架版本,我建议这样做。