报错信息:
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘assetsServiceImpl’: Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘assetsRepository’: Invocation of init method failed; nested exception is org.springframework.data.mapping.PropertyReferenceException: No property testid found for type AssetsPO!
分析:
我在改了一个 @Entity 类的变量名称后,出现了这个错误。看了报错信息,提示在AssetsPO中没有testid 属性,用到这个属性的还有Repository类,于是进去一看发现,
这才明白,原来是这里找不到testid
原因:
这种错误是在JpaRepository 的类中自定义函数,没有对应的字段,例如countByIdAndUserId,但是没有id和userId,更改对应的属性即可