Spring是否要求所有豆子都有一个默认的构造函数?
2022-09-01 16:57:46
我不想为我的类创建默认构造函数。auditRecord
但斯普林似乎坚持这一点:
org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'auditRecord' defined in ServletContext resource
[/WEB-INF/applicationContext.xml]:
Instantiation of bean failed;
nested exception is org.springframework.beans.BeanInstantiationException:
Could not instantiate bean class [com.bartholem.AuditRecord]:
No default constructor found;
nested exception is
java.security.PrivilegedActionException:
java.lang.NoSuchMethodException:
com.bartholem.AuditRecord
这真的有必要吗?