[英]XSD Validation Error in spring-data-elasticsearch
有人對無效的spring-data-elasticsearch.xsd文件有解決方案嗎?
http://www.springframework.org/schema/data/elasticsearch/spring-elasticsearch.xsd
我嘗試加載此xml文件:
<?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:elasticsearch="http://www.springframework.org/schema/data/elasticsearch"
xsi:schemaLocation="http://www.springframework.org/schema/data/elasticsearch http://www.springframework.org/schema/data/elasticsearch/spring-elasticsearch.xsd">
<elasticsearch:transport-client id="ElasticSearchClient" cluster-nodes="localhost:9300" />
<bean name="elasticsearchTemplate" class="org.springframework.data.elasticsearch.core.ElasticsearchTemplate">
<constructor-arg name="client" ref="ElasticSearchClient" />
</bean>
</beans>
但是我收到這些錯誤:
Caused by: org.xml.sax.SAXParseException; systemId: http://www.springframework.org/schema/data/elasticsearch/spring-elasticsearch.xsd; lineNumber: 40; columnNumber: 116; s4s-att-invalid-value: Invalid attribute value for 'source' in element 'documentation': cvc-datatype-valid.1.2.1.
我發現了一些問題,但是沒有人有解決方案。 而且不可能在GitHub Project上創建錯誤問題。
謝謝馬塞爾
我認為不可能毫無問題地使用xsd。 因此,我為此創建了一個配置bean。
package org.example;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.transport.TransportClient;
import org.elasticsearch.common.transport.InetSocketTransportAddress;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.elasticsearch.core.ElasticsearchOperations;
import org.springframework.data.elasticsearch.core.ElasticsearchTemplate;
@Configuration
class ElasticsearchConfiguration
{
@Bean(name="elasticsearchTemplate")
public ElasticsearchOperations elasticsearchTemplate()
{
Client client = new TransportClient().addTransportAddress(new InetSocketTransportAddress("127.0.0.1", 9300));
return new ElasticsearchTemplate(client);
}
}
這對我行得通 ....
馬塞爾
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.