我正嘗試使用ElasticSearch Java API 5.5.1並嘗試爲PreBuiltTransportClient(ES 2.3中的TransportClient)創建一個bean,我面臨以下問題。通過設置彈性5.5.1配置設置來配置Spring bean,並創建一個傳輸客戶端bean
在ServletContext資源[/WEB-INF/applicationContext.xml]中定義名稱爲'preBuildTransportClient'的bean時出錯:通過構造函數參數表示的不滿足依賴項0:無法轉換類型爲[org.elasticsearch.common.settings .Settings $ Builder] to required type [org.elasticsearch.common.settings.Settings]:無法將[org.elasticsearch.common.settings.Settings $ Builder]類型的值轉換爲所需的類型[org.elasticsearch.common.settings .Settings];嵌套異常是java.lang.IllegalStateException:無法將[org.elasticsearch.common.settings.Settings $ Builder]類型的值轉換爲所需類型[org.elasticsearch.common.settings.Settings]:未找到匹配的編輯器或轉換策略
<bean id="settingsBean" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
<property name="targetObject">
<bean id="builderObj" class="org.elasticsearch.common.settings.Settings" factory-method="builder" />
</property>
<property name="targetMethod" value="put" />
<property name="arguments">
<map>
<entry key="cluster.name">
<value>mycluster</value>
</entry>
</map>
</property>
</bean>
<bean id="transportClient" class="org.elasticsearch.transport.client.PreBuiltTransportClient">
<constructor-arg name="settings" ref="esSettingsBuilderStep2" />
<constructor-arg name="plugins">
<null />
</constructor-arg>
</bean>
任何有關爲PreBuiltTransportClient創建bean的建議?