fasterxml.jackson.databind 无效定义异常

我正在尝试使用我定义为端点的 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();

}

}


慕丝7291255
浏览 115回答 1
1回答

幕布斯7119047

在类中声明一个默认构造函数。
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java