使用XML配置的Spring Data Elasticsearch不起作用

时间:2017-04-24 16:02:20

标签: java spring elasticsearch spring-data

我想将ElasticSearch集成到使用旧版spring to load-test let file user-file file-open file let lines [] while [not file-at-end?] [ let a-line file-read set lines lput a-line lines ] file-close end 的应用程序中。

在我的3.0.4.RELEASE中,我添加了pom.xml 2.1.3.RELEASE版本。

此应用程序使用xml base配置,以下是我定义elasticsearch配置(spring-data-elasticsearch)的方法:

elasticSearchConfiguration.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" xmlns:context="http://www.springframework.org/schema/context"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/data/elasticsearch
http://www.springframework.org/schema/data/elasticsearch/spring-elasticsearch-1.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">    

 <elasticsearch:repositories base-package="fr.myapp.search.repository" />
 <elasticsearch:transport-client id="data-api" cluster-nodes="localhost:9300" /></beans>

我正在尝试在服务中使用此repo:

    package fr.myapp.search.repository;

import fr.myapp.search.document.MyDocument;
import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;
import org.springframework.stereotype.Repository;

/**
 * MyDocument
 */
public interface MyDocumentRepo extends ElasticsearchRepository<MyDocument, Long>
{

}

该应用程序是使用public class MyDocumentServiceImpl implements MyDocumentService { @Autowired private MyDocumentRepo myDocumentRepo; ... }

引导的webapp
web.xml

<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> <context-param> <param-name>contextConfigLocation</param-name> <param-value>classpath*:/myApp.xml</param-value> </context-param> ... </web-app> 是导入myApp.xml的主要弹簧配置。

每当我启动webapp时,总会引发此异常:

elasticSearchConfiguration.xml

0 个答案:

没有答案