gpt4 book ai didi

java - bean 类 [com.hazelcast.config.Config] : 的属性 'semaphoreConfigs' 无效

转载 作者:行者123 更新时间:2023-11-30 06:48:38 25 4
gpt4 key购买 nike

我正在尝试在 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)

最佳答案

异常描述表明,由于 getter 返回类型和 setter 参数类型之间存在差异,Spring 3.2.4.RELEASE 无法处理信号量配置。来自 com.hazelcast.config.Config 类:

public Collection<SemaphoreConfig> getSemaphoreConfigs() {...}

public Config setSemaphoreConfigs(Map<String, SemaphoreConfig> semaphoreConfigs) {...}

hazelcast-spring 是针对 Spring framework 4.3.0.RELEASE 构建和测试的并且它正确处理信号量配置创建( tested here )。如果可以选择升级 Spring 框架版本,我建议这样做。

关于java - bean 类 [com.hazelcast.config.Config] : 的属性 'semaphoreConfigs' 无效,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43244654/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com