当前位置:网站首页>@Solution to the problem that the parameters in Hump format in the requestbody annotation transfer object cannot receive data
@Solution to the problem that the parameters in Hump format in the requestbody annotation transfer object cannot receive data
2022-07-22 00:13:00 【12 procedural ape】
1. problem : Hump format parameters are passed to the back end ,@RequestBody The entity object parameter marked by the annotation does not receive the corresponding data
The front end passes the reference :
Execution results :
Request parameter entity :
import lombok.Data;
/** * Request parameters * @author qzz */
@Data
public class DailyInspectTsznoRequestJson {
private String belongedTo;
private String recordNumber;
private String checkFormNumber;
private String tzsno;
private String entCode;
}
2. resolvent :
Method 1 : Modify the format of front-end parameter transfer , Hump format is converted to underline lowercase format
Modify the front-end request parameters to Underline lowercase format :
The back-end receiving parameters remain unchanged .
Restart project , The implementation effect is as follows :
Find out , Problem solved .
Method 2 : Add @JsonProperty("") annotation
, Fill in your own attribute name , That's all right. ( Recommended )
package com.hwariot.device.report.dto.json.request.openapi;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
/** * Request parameters * * Front end delivery belongedTo Wait until the parameters reach the back end ,belongedTo And other parameters are valuable , But when the backend gets it , It's not worth it * terms of settlement : * Add @JsonProperty("") annotation , Fill in your own attribute name , That's all right. * @author qzz */
@Data
public class DailyInspectTsznoRequestJson {
@JsonProperty("belongedTo")
private String belongedTo;
@JsonProperty("recordNumber")
private String recordNumber;
@JsonProperty("checkFormNumber")
private String checkFormNumber;
@JsonProperty("tzsno")
private String tzsno;
@JsonProperty("entCode")
private String entCode;
}
The front-end parameters are saved and the hump format remains unchanged , Modify backend only .
And then restart the project , Re request , The implementation effect is as follows :
It is found that the data has been received , Problem solved .
Be careful : The second method is recommended .
边栏推荐
- 2. Common modules in ansible
- Pychart 2019 usage settings make it easier for you to use!
- Use of source lnsight (read uboot under Samba share)
- Data driven testing of hand-in-hand teaching UI automation
- Install cross compiler: eabi-4.3.3_ EmbedSky_ 20100610.tar. bz2
- 3.使用Ansible中的playbook
- Tcp/ip Foundation
- JFrame needs to be resized before it can be displayed. The setbounds() method in JPanel does not work
- @Correct use of requestparam annotation
- MySQL learning notes
猜你喜欢
Part 04: guava retry component
Navicat was selected into the "global database industry map" released by the Academy of information technology
Assembly language homework
The actual case of Cisco configuring single arm routing is very simple
top及ifconfig命令
Detailed explanation of PE file structure
Datagrip 2021 uses settings that make it smoother to use
One click batch termination of processes according to the process name (chromedriver.exe)
JMeter read response header information / get request header
The danger of testing SQL | don't take it lightly
随机推荐
Atomic quotation to solve ABA problem
Implementation of static address book
Use Mysql to query logs slowly
LAMP架構——mysql路由器(讀寫分離器)
物联网嵌入式——学习分享
The danger of testing SQL | don't take it lightly
What happens when you have threads
[untitled] this year's noteworthy God book, Douban scored as high as 9.0, and Jingdong Dangdang is available for sale
One click batch termination of processes according to the process name (chromedriver.exe)
The database is for the salaries table emp above_ No field create index idx_ emp_ no
JMeter's BeanShell generates random Chinese characters
Piracy leads to device paralysis | official solemn statement: do not buy or download Navicat through unofficial channels
Variable usage method of BeanShell of JMeter
LAMP架构——mysql的安装部署、mysql集群及主从结构(1)
Geographic scene visualization system based on GeoServer
PeopleSoft update table interface program
Synchronization and mutual exclusion of processes
高可用集群Keepalived
Pychart 2019 usage settings make it easier for you to use!
Zabbix+分布式数据库TiDB实现分布式数据库监控