2016-09-16 1 views
1

hazelcast.properties & hazelcast config.xml 파일을 모두 classpath에 배치했습니다.구성 XML의 속성 파일에서 값을 읽을 수 없습니다.

<context:property-placeholder file-encoding="UTF-8" location="classpath:spring-env/dev.properties" /> 
<hz:hazelcast id="instance"> 
    <hz:config> 
     <hz:instance-name>hz_instance</hz:instance-name> 
     <hz:group name="dev" password="password"/> 
     <hz:network port="${hazelcast.port}" port-auto-increment="false"> 
      <hz:join> 
       <hz:multicast enabled="false"/> 
       <hz:tcp-ip enabled="true"> 
        <hz:members>${hazelcast.members}</hz:members> 
       </hz:tcp-ip> 
      </hz:join>    
     </hz:network> 

모든 것이 잘 작동하지만 서버가 시작되면, 다음은 로그에 나타납니다 :

INFO: Configuring Hazelcast from 'file:/E:/.../MyApp/WEB-INF/classes/applicationContext-hazelcast.xml'. 
Sep 16, 2016 3:15:47 PM com.hazelcast.config.AbstractConfigBuilder 
WARNING: Could not find a value for property 'hazelcast.port' on node: port 
Sep 16, 2016 3:15:47 PM com.hazelcast.config.AbstractConfigBuilder 
WARNING: Could not find a value for property 'hazelcast.members' on node: null 

내 ApplicationContext를-hazelcast.xml 내부

resources 
|_ 
| spring-env 
| |_ 
| dev.properties 
|_ 
    applicationContext-hazelcast.xml 

: 이것은 내 디렉토리 구조 내 dev.properties 파일에 다음 속성을 지정해 두었습니다.

#hazelcast properties 
hazelcast.port = 35701 
hazelcast.members = 127.0.0.1 

dev.properties 파일의 $ {hazelcast.port} & $ {hazelcast.member} 속성에 대한 값을 찾을 수없는 이유는 무엇입니까?

참고 : 나는 수동으로 구성된 캐시 맵에 대해 최대 절전 모드 - 초 레벨 캐시 &에 동일한 구성 파일을 사용하고 있습니다.

답변

1

당신이 당신의 재산이 시스템 프로퍼티hazelcast.porthazelcast.members을 즉 정의하면, 그것은 작동합니다.

HazelcastCacheRegionFactory 전에 시작하여 dev.properties에서 이러한 속성을 읽고 System.property로 설정합니다.

관련 문제