spring No default constructor found; nested exception is java.lang.NoSuchMethodException:

错误内容提示:
spring No default constructor found; nested exception is java.lang.NoSuchMethodException:

此时截图已经加上无参构造器了,所以没有显示红色波浪线,但是还未运行,可看错误提示:
spring No default constructor found; nested exception is java.lang.NoSuchMethodException:
2.加上无参构造函数后
spring No default constructor found; nested exception is java.lang.NoSuchMethodException:

3.分析后,它说我没有model的无参构造函数,但是我传递过来的有参的。这就需要讨论实现原理了。
首先感觉是接受页面的parameter 可能name 不和model 的属性不匹配,所以就相当于没有该model的参数传递过来,调用该model的无参构造方法。由于bean 是在未调用前就已经创建的,所以创建bean 时候考虑了这样的问题,所以必须有为空的构造函数。
4.结果如图所示:
spring No default constructor found; nested exception is java.lang.NoSuchMethodException: