@PostMapping,@PutMapping,@DeleteMapping,@GetMapping,@GetMapping标红
控制类@PostMapping等报错,而@RequestMapping正常,问题是pom.xml中一些依赖的版本号不正确 @RestController//控制器类注解 @RequestMapping("/books") //这个模块的公共映射 public class BookController { //自动装配,调业务层接口 @Autowired private BookService bookService; @PostMapping public boolean save(Book book) { return bookService.save(book); } @PutMapping public boolean update(Book book) { return bookService.update(book); } @DeleteMapping public boolean delect(Integer id) { return bookService.delect(id); } @GetMapping public Book getById(Integer id) { return bookService.getById(id); } @GetMapping public List<Book> getAll() { return bookService.getAll(); } }