使用Querydsl与spring boot和elasticsearch时的问题

时间:2016-12-13 15:14:35

标签: spring-boot querydsl spring-data-elasticsearch

我正在尝试将Querydsl用于我的spring boot starter elasticsearch项目。我在我的pom.xml中添加了以下依赖项

<dependency> 
        <groupId>com.querydsl</groupId> 
        <artifactId>querydsl-core</artifactId> 
        <version>${querydsl.version}</version><!--$NO-MVN-MAN-VER$-->
    </dependency> 
    <dependency> 
        <groupId>com.querydsl</groupId> 
        <artifactId>querydsl-apt</artifactId>
        <version>${querydsl.version}</version>
    </dependency>

我还添加了插件 -

<plugin>
            <groupId>com.mysema.maven</groupId>
            <artifactId>apt-maven-plugin</artifactId>
            <version>1.1.3</version>
            <executions>
                <execution>
                    <goals>
                        <goal>process</goal>
                    </goals>
                    <configuration>
                        <outputDirectory>target/generated-sources/java</outputDirectory>
                        <processor>com.querydsl.apt.QuerydslAnnotationProcessor</processor>
                    </configuration>
                </execution>
            </executions>
        </plugin>

我可以看到生成的类,但在mvn包中,我可以看到以下错误

Caused by: java.lang.IllegalArgumentException: QueryDsl Support has not been implemented yet.
    at org.springframework.data.elasticsearch.repository.support.ElasticsearchRepositoryFactory.getRepositoryBaseClass(ElasticsearchRepositoryFactory.java:73)
    at org.springframework.data.repository.core.support.RepositoryFactorySupport.getRepositoryInformation(RepositoryFactorySupport.java:252)
    at org.springframework.data.repository.core.support.RepositoryFactorySupport.getRepository(RepositoryFactorySupport.java:195)
    at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.initAndReturn(RepositoryFactoryBeanSupport.java:282)
    at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.afterPropertiesSet(RepositoryFactoryBeanSupport.java:268)
    at org.springframework.data.elasticsearch.repository.support.ElasticsearchRepositoryFactoryBean.afterPropertiesSet(ElasticsearchRepositoryFactoryBean.java:55)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1654)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1591)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:566)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:302)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:298)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:198)
    at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1087)
    at org.springframework.data.repository.support.Repositories.cacheRepositoryFactory(Repositories.java:95)
    at org.springframework.data.repository.support.Repositories.populateRepositoryFactoryInformation(Repositories.java:88)

我找不到这个组合的任何例子。有人能帮我吗? 提前致谢

1 个答案:

答案 0 :(得分:1)

我一直在寻找这个组合的一些例子,但找不到任何。

到目前为止,Spring Data Elasticsearch(版本3.0.0)的 QueryDsl支持尚未实现。在检查代码here时找到此信息。对于此集成,Jira上还有待处理的issue

但是,如果您检查Spring Data Elasticsearch,则会有一个关于QueryDsl支持的部分。我担心此部分与实施不同步。