springboot接口,参数为实体类怎么写

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接: https://blog.csdn.net/weixin_43806056/article/details/92594683

springboot 接口保存一个实体对象,在swagger中显示string错误,因为要用RequestBody。

在这里插入图片描述
我们只需要修改,control层的RequestBody 。

public void saveallmessage(@RequestBody HostLineField hostlinefield) {
ihostlineservice.saveallmess(hostlinefield);
}
再次运行,成功显示json输入格式。
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/weixin_43806056/article/details/92594683