最近在项目中加入了Hazelcast第三方插件,在与Spring集成的时候,将Hazelcast配置到Spring的配置文件当中,出现了不能通过属性注入的方法,给属性赋值,代码如下:
<bean id="hazelcast" class="com.hazelcast.core.Hazelcast"
factory-method="newHazelcastInstance">
<constructor-arg>
<bean class="com.hazelcast.config.Config">
<property name="port" value="5701" />
<property name="portAutoIncrement" value="true" />
<property name="groupConfig">
<bean class="com.hazelcast.config.GroupConfig">
<property name="name" value="dev" />
<property name="password" value="pwd" />
</bean>
</property>
<property name="networkConfig">
<bean class="com.hazelcast.config.NetworkConfig">
<property name="join">
<bean class="com.hazelcast.config.Join">
<property name="multicastConfig">
<bean class="com.hazelcast.config.MulticastConfig">
<property name="enabled" value="false" />
<property name="multicastGroup" value="224.2.2.3" />
<property name="multicastPort" value="54327" />
</bean>
</property>
<property name="tcpIpConfig">
<bean class="com.hazelcast.config.TcpIpConfig">
<property name="enabled" value="true" />
<property name="members">
<list>
<value>10.2.108.194</value>
<value>10.253.73.24</value>
</list>
</property>
</bean>
</property>
</bean>
</property>
</bean>
</property>
</bean>
</constructor-arg>
</bean>
Ok, solved it. Phew.
Apparently Spring dont like you to do 'fluent interfaces', e.g. setters of the type:
public int setValue(int newValue) {
value = newValue;
return newValue;
}
For each attribute with such a setter I got the reported error. Changing the code to:
public void setValue(int newValue) {
value = newValue;
}
Solved the problem...
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。