我是靠谱客的博主 笑点低水蜜桃,这篇文章主要介绍Failed to instantiate [com.XXX.entity.People],现在分享给大家,希望可以做个参考。

今天在Spring Boot工程启动时报错了Failed to instantiate [com.fyy.entity.People],提示不能初始化该类,原因是找不到默认的构造方法,我看了一下,我也有写构造方法:

复制代码
1
2
3
4
5
6
public People() { super(); this.id = id; this.name = name; this.age = age; }

后来才恍然大悟,原来在使用注解把类注解为Bean时,默认的构造方法是无参构造方法,

解决办法是改成默认无参构造方法

复制代码
1
2
3
public People() { super(); }

测试类中有许多Junit的@Test方法,通过右键类名来单独测试某个项目

最后

以上就是笑点低水蜜桃最近收集整理的关于Failed to instantiate [com.XXX.entity.People]的全部内容,更多相关Failed内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(63)

评论列表共有 0 条评论

立即
投稿
返回
顶部