【spring boot】在Spring mvc中controller中可以拿到对象信息,但是返回给前台却是什么也没有,解决方案

如图所示:

最后:

问题解决:

这个原因是因为,User类并未给字段提供get/set方法,所以给前台传递过去的值是空的。

解决方案:

为User类添lombok的注解@Data,为实体类提供get/set方法

原文地址:https://www.cnblogs.com/sxdcgaq8080/p/8759439.html