开发者社区> 问答> 正文

Hazelcast与Spring集成问题

最近在项目中加入了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>

展开
收起
a123456678 2016-03-17 09:51:24 2955 0
1 条回答
写回答
取消 提交回答
  • 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...

    2019-07-17 19:04:32
    赞同 展开评论 打赏
问答分类:
问答地址:
问答排行榜
最热
最新

相关电子书

更多
The Reactive Cloud Native Arch 立即下载
集成智能接入网关APP:优化企业级移动办公网络 立即下载
云效助力企业集成安全到DevOps中 立即下载