我想在我的spring JUnit測試中啓動一個hazelcast實例。下面是XML配置我試圖加載作爲@ContextConfigurationbean class [com.hazelcast.config.Config]的屬性'semaphoreConfigs':
<?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:無效的屬性Bean類的[semaphoreConfigs] [com.hazelcast.config.Config]:Bean屬性'semaphoreConfigs'不可寫或具有無效的setter方法。 setter的參數類型是否與getter的返回類型相匹配? 在org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:1042) 在org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:902) 在org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor。的java:75) 在org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:57)
什麼Hazelcast版本?什麼春天的版本? Spring Boot還是簡單的Spring框架? – noctarius
這是普通的Spring框架,Java版本是JDK 1.7。 Hazelcast是3.8和Spring版本是3.2.4.RELEASE。我實際上正在修改一箇舊的項目,並嘗試寫一些測試來實現它的工作。 –