SpringMVC cannot map an array in an object

there is an object in the background

Class Code {
    private List<String> data;
    private int msg;
}

controller

public Object test(@ModelAttribute Code code)

the front end submits data to the background

$.get("http://xxxxx",{
    data: ["123","123"],
    msg: "121313"
},)

background cannot map data to data

Mar.25,2021

the backend interface is received with @ RequestBody , and then the front end is submitted in json format


positive solution upstairs, change it to

public Object test(@RequestBody Code code)

pay attention to the header application/json when submitting the front end

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b30f48-2b5a9.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b30f48-2b5a9.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?