为了账号安全,请及时绑定邮箱和手机立即绑定

fasterxml.jackson.databind 无效定义异常

fasterxml.jackson.databind 无效定义异常

慕丝7291255 2023-11-01 21:41:15
我正在尝试使用我定义为端点的 URL 执行发布请求。控制器代码: import java.util.List;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.stereotype.Controller;import org.springframework.web.bind.annotation.CrossOrigin;import org.springframework.web.bind.annotation.GetMapping;import org.springframework.web.bind.annotation.PostMapping;import org.springframework.web.bind.annotation.RequestBody;import org.springframework.web.bind.annotation.RequestMapping;import org.springframework.web.bind.annotation.ResponseBody;import com.abc.datacollection.Constants;import com.abc.datacollection.dao.UserClickDataRepository;import com.abc.datacollection.entity.UserClickData;import com.abc.datacollection.entity.UserClickProjection;import com.abc.datacollection.entity.UserClickProjection2;@Controller    @RequestMapping(path="/user_click_data") public class UserClickDataController {    @Autowired     private UserClickDataRepository userClickDataRepository;    /**     * this method adds user click data records into user_click_data table     * @param searchHisObj     * @return     */    @CrossOrigin(origins = "*")    @PostMapping(path="/add", consumes = "application/json", produces = "application/json") // Map ONLY POST Requests    public @ResponseBody String addUserClickDataRecord (@RequestBody List<UserClickData> searchHisObj) {        userClickDataRepository.saveAll(searchHisObj);        System.out.println("saved click data:"+searchHisObj);        return Constants.STATUS_OK;    }    /** * this method fetches all user click data records from user_click_data table * @return */@CrossOrigin(origins = "*")@GetMapping(path="/all")public @ResponseBody List<UserClickProjection> getAllUserClickDataRecords() {    return userClickDataRepository.findAllProjectedBy();}@CrossOrigin(origins = "*")@GetMapping(path="/allsecond")public @ResponseBody List<UserClickProjection2> getAllUserClickDataRecords2() {    return userClickDataRepository.findAllProjectedBy2();}}
查看完整描述

1 回答

?
幕布斯7119047

TA贡献1794条经验 获得超8个赞

在类中声明一个默认构造函数。


查看完整回答
反对 回复 2023-11-01
  • 1 回答
  • 0 关注
  • 114 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信