0
我試圖配置java gemfire模板來查詢spring應用程序中的數據。
創建春天模板我需要創建客戶端區域,創建客戶端區域我需要創建客戶端緩存,創建客戶端緩存我需要創建池。
其中一個池參數是server-goup。我需要gemfire模板來查詢其中的幾個。
我沒有發現池可以配置爲幾個服務器組,所以我創建了兩個池(使用不同的服務器組),兩個客戶端緩存兩個客戶區和兩個模板,並且出現錯誤。沒有定義[com.gemstone.gemfire.cache.GemFireCache]類型的唯一bean:期望的單一bean但找到了2
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [com.gemstone.gemfire.cache.GemFireCache] is defined: expected single bean but found
我失蹤了什麼?我該如何解決這個錯誤,或者設法爲多個服務器組設置客戶區域?
這裏是Spring上下文:
<?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:gfe="http://www.springframework.org/schema/gemfire"
xmlns:util="http://www.springframework.org/schema/util"
xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/gemfire http://www.springframework.org/schema/gemfire/spring-gemfire.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd
http://www.springframework.org/schema/data/gemfire http://www.springframework.org/schema/data/gemfire/spring-data-gemfire.xsd">
<gfe:pool id="mdfClientDataPool" subscription-enabled="true" server-group="clientData">
<gfe:locator host="${gemfire.locator.primary.1}" port="${gemfire.locator.primary.port.1}" />
</gfe:pool>
<gfe:client-cache id="mdfClientDataCache" pool-name="mdfClientDataPool" properties-ref="gemfireProperties" />
<gfe:client-region id="mdfClientDataRegion" cache-ref="mdfClientDataCache" />
<bean id="mdfClientDataTemplate" class="org.springframework.data.gemfire.GemfireTemplate" p:region-ref="mdfClientDataRegion" />
<gfe:pool id="mdfInstrumentDataPool" subscription-enabled="true" server-group="instrumentData">
<gfe:locator host="${gemfire.locator.primary.1}" port="${gemfire.locator.primary.port.1}" />
</gfe:pool>
<gfe:client-cache id="mdfInstrumentCache" pool-name="mdfInstrumentDataPool" properties-ref="gemfireProperties" />
<gfe:client-region id="mdfInstrumentRegion" cache-ref="mdfInstrumentCache" />
<bean id="mdfInstrumentTemplate" class="org.springframework.data.gemfire.GemfireTemplate" p:region-ref="mdfInstrumentRegion" />
</beans>
感謝。
試圖做幾個小時沒有運氣,你有任何網絡上的例子或鏈接? –
我不知道這個的任何示例或測試,但它是一個有效的用例。你能粘貼你的配置嗎?或者,如果您確信自己已經正確配置了我所描述的內容,我會將問題提交到https://jira.spring.io/browse/SGF並在此處發佈配置。 – dturanski
考慮到[服務器組概述](http://pubs.vmware.com/vfabric53/index.jsp?topic=/com.vmware.vfabric.sqlfire.1.1/data_management/ServerGroups.html)和[將表分配給服務器組](http://pubs.vmware.com/vfabric53/index.jsp?topic=/com.vmware.vfabric.sqlfire.1.1/data_management/server-groups-chapter.html)不應請求服務器配置數據在單個服務器組中可用,然後使用單個客戶端池與單個服務器組,單個客戶端緩存(使用單個池)和多個區域(使用單個客戶端緩存)? –