Issue when using Querydsl with spring boot and elasticsearch

1.1k views Asked by At

I am trying to use Querydsl with my spring boot starter elasticsearch project. i have added following dependencies in my 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>

i have also added plugin -

<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>

I can see generated classes, but during mvn package, i can see following errors

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)

I couldn't find any example for this combination. can someone help me? Thanks in advance

1

There are 1 answers

0
Rafael Santana On

I have been looking for some example for this combination too, but could not find any.

Apparently, QueryDsl Support has not been implemented yet for Spring Data Elasticsearch (Release 3.0.0) so far. Found this information while checking the code here. There is an pending issue on Jira for this integration too.

However, if you check the Spring Data Elasticsearch, there is a section about QueryDsl support. I'm afraid this section is out of sync with the implementation.