spring - Spring Boot 尝试创建从项目中删除的类
问题描述
我删除了其中一个Components
项目:
@Component
public interface ClientRepo extends CrudRepository<Client, Integer> {
}
我已将Client
课程从更改Entity
为Embeddable
@Getter
@Setter
@Embeddable
public class Client {
@NotNull
@Size(max = 200)
private String email;
@NotNull
@Size(max = 200)
private String phoneNumber;
}
在这里我使用这个Client
类:
@Entity
@Table(name = "MEETINGS")
public class Meeting extends BaseEntity {
@Embedded
private Client client;
}
*这是我尝试启动项目时得到的结果:**
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'clientRepo': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: The given domain class does not contain an id attribute!
解决方案
根据我的评论添加答案:当您从项目中删除或重命名一个类时,请务必清理您的构建目录以摆脱其已编译的 .class 等效项。如果您使用的是 maven,则可以通过调用clean命令或手动删除目标目录来完成。
推荐阅读
- django - 为什么 Heroku 在我部署 Django 应用程序时给我一个 H10 错误
- angular - 制作角度图像裁剪器功能
- insert - 插入语句内的表中的自动增量 ID
- python - 尝试重置密码时出现 Djongo + Django + MongoDB Atlas DatabaseError
- python - AssertionError: [101, 1203, 1365, 1137, 8601, 117, 4835, 1104, 1141, 1292, 119, 102, 0, 0, 0, 0, 0, 0, 0, 0] 不是
- c++ - 为什么复制初始化需要 C++17 中的析构函数并保证移动/复制省略?
- python - 创建 Pandas.Dataframe 时如何保持索引中的顺序
- javascript - 仅将 .map() 方法用于副作用是否合法?
- c# - ASP.NET MVC 5 - 使用带有或不带有 __RequestVerificationToken 的 ajax 将视图模型数组发布到控制器
- x86 - WinDbg:地址中的冒号是什么意思?