为什么会报无法从静态方法中引用非静态方法
代码如下:
package com.oa.oa_sys; import com.sun.prism.impl.Disposer; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import java.util.Date; import java.util.List; @RestController public class record_Controller { @Autowired private RecordInfoRepository recordInfoRepository; /** * 查询加班记录 * @return */ @GetMapping(value = "/record_info") public List<record> Recordlist() { return recordInfoRepository.findAll(); } /** * 添加一条加班记录 * @return */ @PostMapping(value = "/record_info") public record recordinfoAdd(@RequestParam("user_id") Integer use_id, @RequestParam("work_date")Date work_date, @RequestParam("work_hours") Integer work_hours, @RequestParam("status") Integer status) { record Record = new record(); Record.setUse_id(use_id); Record.setWork_date(work_date); Record.setWork_hours(work_hours); Record.setStatus(status); return RecordInfoRepository.save(Record); } }