<context:component-scan> XML tag. Tells Spring that where to look for Spring Components explicitly. @ComponentScan annotation is used with @Configuration annotation.@RestController
public class Book{
@RequestMapping(value = "/books", method = RequestMethod.GET)
public Book getBook(){
return book;
}
}
@Controller
public class Book{
@RequestMapping(value = "/books", method = RequestMethod.GET)
@ResponseBody
public Book getBook(){
//...
return book;
}
}
java
@GetMapping("/api/employees/{id}")
public String getEmployeesById(@PathVariable String id) {
return id;
}