I'm looking at code in which I'm assuming spring decides to use Jackson behind the scenes to auto convert an object to json for a @RestController
@RestController
@RequestMapping("/api")
public class ApiController {
private RoomServices roomServices;
@Autowired
public ApiController(RoomServices roomServices) {
this.roomServices = roomServices;
}
@GetMapping("/rooms")
public List<Room> getAllRooms() {
return this.roomServices.getAllRooms();
}
}
The Room class is just a plain java class with some fields, getters/setters. There is no Jackson or any other explicit serialization going on in the code. Although this does return json when checking the url. I tried looking through the spring documentation but I'm not quite sure what I'm looking for. What is the name for this process in spring / how does it work? I tried with just @Controller and it broke. Is this functionality coming from @RestController?