A simple task management application using Spring boot that performs CRUD operations using REST controller
CRUD stands for Create, Read, Update and Delete. As the name suggests it performs the related operations on the relational database and mapped to standard HTTP method.
@GetMapping("/alltasks")
public List<Task> getAllTasks() {
return taskService.getAllList();
}
Get all tasks stored by a Get Mapping method

@RequestMapping("/getTask")
public Task getTask(@RequestParam("id") Integer id) {
return taskService.getTask(id);
}
@PostMapping(value="/saveTask")
public void createTask(@RequestBody Task task) {
taskService.createTask(task);
}
The save task method uses post mapping. It gets a task body as an input and stores into the DB.
After saving new Task

@RequestMapping(value = "/changeStatus", method = RequestMethod.PUT)
public void updateStatus(@RequestParam("id") Integer id, @RequestBody Task task ) {
taskService.updateStatus(id, task);
}
The Change status method uses PUT method to update the status of the task by getting id as a parameters and the whole task body as input.
Before Change Task
After Change Task

@DeleteMapping(value = "/deleteTask")
public void deleteTask(@RequestParam("id") Integer id) {
taskService.deleteTask(id);
}
