【问题标题】:Error while setting up Spring Data JPA Read-Only Repository设置 Spring Data JPA 只读存储库时出错
【发布时间】:2015-11-08 21:53:58
【问题描述】:

Spring Boot:1.3.0.RC1

Spring Boot Starter JPA:1.3.0.RC1

在设置 Spring Data JPA 只读存储库时遇到问题。

@NoRepositoryBean
public interface ReadOnlyRepository<T, ID extends Serializable> extends Repository<T, ID> {
    T findOne(ID id);
    Iterable<T> findAll();
    Iterable<T> findAll(Sort sort);
    Page<T> findAll(Pageable pageable);
}

使用 IntelliJ 15 我收到此编译错误:

Error:(16, 83) java: type org.springframework.stereotype.Repository does not take parameters

这段代码的错误点:Repository&lt;T, ID&gt;

Spring Data JPA 中是否发生了一些变化?我是不是做错了什么?

以下示例如下:Fine-tuning Spring Data repositories

【问题讨论】:

    标签: intellij-idea spring-boot spring-data-jpa


    【解决方案1】:

    错误指向正确的方向。 IntelliJ 15 在使用 ctrl space 时会拉取 Repository Stereotype import org.springframework.stereotype.Repository 而不是正确的 import org.springframework.data.repository

    如果您快速键入并且没有注意到错误的导入,您将收到上述错误。

    【讨论】:

      猜你喜欢
      • 2021-01-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-08-06
      • 2012-06-21
      • 2016-12-26
      • 2018-09-17
      • 2018-10-06
      相关资源
      最近更新 更多