Exception
org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [util.Params]: No default constructor found; nested exception is java.lang.NoSuchMethodException: util.Params.()
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:982)
出错地方:
package util;
//分页工具类
public class Params {
private int pageNum;//当前页
private int pageSize=2;//每页条数
public Params(int pageNum, int pageSize) {
this.pageNum = pageNum;
this.pageSize = pageSize;
}
public int getPageNum() {
return pageNum;
}
public void setPageNum(int pageNum) {
this.pageNum = pageNum;
}
public int getPageSize() {
return pageSize;
}
public void setPageSize(int pageSize) {
this.pageSize = pageSize;
}
@Override
public String toString() {
return "Params{" +
"pageNum=" + pageNum +
", pageSize=" + pageSize +
'}';
}
}
解决方法: 工具类里面只需要添加get 和set 方法就行了,不用添加构造方法。