spring:p名称空间实例化对象
Error creating bean with name ‘car’ defined in class path resource [ApplicationContext.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [domain.Car]: No default constructor found; nested exception is java.lang.NoSuchMethodException: domain.Car.()
刚开始练习spring,使用p名称空间实例化对象时遇到这样的报错问题:
核对原因之后是因为BeanInstantiationException:没有实例化Cat,构造函数异常;
解决方法:在实体类中加入无参的构造函数。