@Controller
: This annotation is just a specialized version of @Component
and it allows the controller classes to be auto-detected based on classpath scanning.@RestController
: This annotation is a specialized version of @Controller
which adds @Controller
and @ResponseBody
annotation automatically so we do not have to add @ResponseBody
to our mapping methods.