创建名称为'transactionRepository'的bean时出错:无法解析匹配的构造函数

时间:2018-07-11 11:05:37

标签: java spring-boot spring-data amazon-dynamodb crud

我正在尝试将DynamoDB在本地集成到我的Spring Boot项目中。 它曾经与Spring Data JPA一起使用,现在我试图切换到Spring Data Dynamo DB

我将此行添加到属性文件中

spring.jpa.properties.hibernate.temp.use_jdbc_metadata_defaults = false

存储库:

@EnableScan
public interface TransactionRepository extends CrudRepository<Transaction, Long> {
}

实体定义

@DynamoDBTable(tableName = "Transaction")
public class Transaction {

    private long id;
    /**
     * Transaction category
     */
    Category category;

    /** Transaction amount */
    double amount;

    @DynamoDBAttribute
    public Category getCategory() {
        return category;
    }

    public void setCategory(Category category) {
        this.category = category;
    }

    @DynamoDBAttribute
    public double getAmount() {
        return amount;
    }

    public void setAmount(double amount) {
        this.amount = amount;
    }

    @DynamoDBHashKey
    @DynamoDBAutoGeneratedKey
    public long getId() {
        return id;
    }

    Transaction() {
        this.setAmount(0);
        this.setCategory(Category.OTHER);
    }

    public Transaction(double amount, Category category) {
        this.setAmount(amount);
        this.setCategory(category);
    }
}

0 个答案:

没有答案