问题描述
使用SpringBoot 2.2.0版本,JPA版本与之对应
描述:使用SpringDataJPA练习时,项目启动时报Repositry接口类的Bean为null,不知是何原因,一场日志如下
***************************
APPLICATION FAILED TO START
***************************
Description:
The bean 'billPaymentRepositry', defined in null, could not be registered. A bean with that name has already been defined in null and overriding is disabled.
Action:
Consider renaming one of the beans or enabling overriding by setting spring.main.allow-bean-definition-overriding=true
代码如下
@Repository
public interface BillPaymentRepositry extends JpaRepository<BillPayment,Integer> {
}
实体类
package com.sponge.spongebill.entity;
import javax.persistence.*;
import java.util.Date;
@Entity
@Table(name = "b_payment")
public class BillPayment {
@Id
@GeneratedValue
private Integer paymentId;
@Column
private String paymentName;
@Column
private Integer enable; // 0-启用 1-禁用
@Column
private Date createTime;
// get set 方法此处省略
}
有知道原因的大侠希望能够解开小弟的困惑,跪拜了