1
我已將hazelcast.properties & hazelcast config.xml文件放在classpath中。這是我的目錄結構:無法從配置XML中的porperties文件讀取值
resources
|_
| spring-env
| |_
| dev.properties
|_
applicationContext-hazelcast.xml
裏面我的applicationContext-hazelcast.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
雖然我在dev.properties文件中指定了這些屬性:
#hazelcast properties
hazelcast.port = 35701
hazelcast.members = 127.0.0.1
任何想法爲什麼它無法爲dev.properties文件中的$ {hazelcast.port} & $ {hazelcast.member}屬性找到值?
注意:對於手動配置的緩存映射,我正在使用相同的配置文件作爲休眠第二級緩存&。