Fresher interview questions
Spring Boot is an opinionated framework built on top of Spring that removes boilerplate configuration through auto-configuration, starter dependencies and an embedded server, letting you run apps with a single command.
A starter is a curated bundle of related libraries that Spring Boot lets you add with a single dependency line, instead of hunting down every individual library and making sure their versions are compatible with each other. For example, spring-boot-starter-web pulls in the embedded web server, the JSON conversion library and the core Spring MVC pieces needed to build a web application, all tested together as one working set.
Starters exist for almost every common need, including spring-boot-starter-data-jpa for database access, spring-boot-starter-security for authentication, and spring-boot-starter-test for testing tools. Using starters is one of the main reasons a new Spring Boot project can go from an empty folder to a running application in minutes rather than hours, since the tedious work of dependency matching has already been done for you.
The @RestController annotation marks a class as a web controller whose methods return data directly in the response body, such as JSON or plain text, rather than the name of an HTML page to render. It is actually a shortcut that combines two other annotations, @Controller, which marks the class as a request handler, and @ResponseBody, which tells Spring to write whatever a method returns straight into the response instead of treating it as a view name.
This is the annotation to reach for whenever you are building a REST API meant to be consumed by a mobile app, a JavaScript front end, or another service, since those clients expect structured data back, not a rendered web page. For a traditional server-rendered website instead, plain @Controller returning template names is the right pattern, which is exactly what the Thymeleaf tutorial covers.