Spring引导它是从必需的.class文件

时间:2016-12-02 18:52:17

标签: java spring maven spring-boot

我在我的存储库中添加了以下内容

@Repository
public interface ReceiptRepository extends JpaRepository<Receipt, Integer>, QueryDslPredicateExecutor<Receipt>{
    public Page<Receipt> findForCriteria(Predicate predicate, Pageable p);
}

QueryDslPredicateExecutor 我正在导入

import org.springframework.data.querydsl.QueryDslPredicateExecutor;

谓词我正在导入(我不确定它是否是正确的)

import org.springframework.cglib.core.Predicate;

但是在我的包名称中,我收到一条错误消息

Multiple markers at this line
- The type com.querydsl.core.types.Predicate cannot be resolved. It is indirectly referenced from required .class 
 files
- The type com.querydsl.core.types.OrderSpecifier cannot be resolved. It is indirectly referenced from 
 required .class files

我的假设是有2个不同的jar文件具有相同的包名。那是对的吗?如果是,那么我该如何删除?

这是我的pom.xml依赖项

    <dependencies>
    <dependency>
        <groupId>com.googlecode.json-simple</groupId>
        <artifactId>json-simple</artifactId>
        <version>1.1.1</version>
    </dependency>
    <dependency>
        <groupId>com.amazonaws</groupId>
        <artifactId>aws-java-sdk-s3</artifactId>
        <version>1.11.60</version>
    </dependency>
    <dependency>
        <groupId>org.resthub</groupId>
        <artifactId>springmvc-router</artifactId>
        <version>1.2.0</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-jpa</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>

    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <scope>runtime</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-tomcat</artifactId>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-velocity</artifactId>
    </dependency>
</dependencies>

知道如何解决这个问题吗?

1 个答案:

答案 0 :(得分:0)

I have added the below dependency and the error got resolved.

<dependency>
            <groupId>com.querydsl</groupId>
            <artifactId>querydsl-apt</artifactId>

        </dependency>
        <dependency>
            <groupId>com.querydsl</groupId>
            <artifactId>querydsl-jpa</artifactId>

        </dependency>