初始化失败_Destroying singletons

博客讲述了作者在配置Spring Bean时遇到的问题,由于缺少无参构造函数导致初始化单例失败,浪费了较长时间解决这个问题。异常信息显示在尝试创建'department' bean时,依赖的'employee1' bean无法实例化,原因是找不到类com.gwp.zcc.domain.Employee的默认构造函数。
摘要由CSDN通过智能技术生成
这个错误的根源是因为我没有提供无参的构造函数 靠 搞得 浪费了我大概三个多小时的时间。。。。啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊。。。。。。。



信息: Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@1a42792: defining beans [department,employee1,employee2,employee4]; root of factory hierarchy
Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'department' defined in class path resource [com/gwp/zcc/test/beans.xml]: Cannot resolve reference to bean 'employee1' while setting bean property 'empList' with key [0]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'employee1' defined in class path resource [com/gwp/zcc/test/beans.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.gwp.zcc.domain.Employee]: No default constructor found; nested exception is java.lang.NoSuchMethodException: com.gwp.zcc.domain.Employee.<init>()
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:275)
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值