Failed to instantiate No default constructor found; nested exception is java.lang.NoSuchMethodExcept

从网页接受参数,参数多的情况下一般会定义一个类,来装这些参数,比如UserParam这个类就是装网页里面转过来的

id、username、telephone等信息。但是会发现在修改的时候会报如下错误。

报错信息如下:

org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.mmall.param.UserParam]: 
      No default constructor found; nested exception is java.lang.NoSuchMethodException:
      com.mmall.param.UserParam.()

解决办法:

把UserParam里面的@Builder注解去掉。

@Getter
@Setter
@Builder   //这里的@Builder一定要去掉。否则在修改的时候会失败
public class UserParam {...}

 

你可能感兴趣的:(报错信息)