无法使用参数Spring Boot进行参数化

时间:2018-10-05 09:16:31

标签: java spring spring-boot cassandra

package com.ksfe.auditlog.repository;

import org.springframework.data.cassandra.repository.CassandraRepository;

import com.ksfe.auditlog.model.Customer;

public interface CustomerRepository extends CassandraRepository<Customer> {

}

,其中错误显示为 类型CassandraRepository的参数数目不正确;不能使用参数

对其进行参数化

2 个答案:

答案 0 :(得分:0)

更改此

public interface CustomerRepository extends CassandraRepository<Customer>

public interface CustomerRepository extends CassandraRepository<Customer,Integer>

也通过添加id参数。

注意:整数/长整数取决于ID类型。

答案 1 :(得分:0)

更改spring boot和spring-data版本以匹配本文中使用的版本,或者在您的实体中添加第二个参数,其ID字段类型为

public interface CustomerRepository extends CassandraRepository<Customer,Long> {}

从2.0.0版开始,大多数spring数据存储库都有两个参数。