Difference between @Controller and @RestController in Spring MVC?
@Controller is used to declare common web controllers which can return HTTP response but @RestController is used to create controllers for REST APIs which can return JSON.
Hello friends, if you are preparing for a Java developer interview with Spring experience then you may have come across the “difference between @Controller and @RestController annotation” in Spring Boot and Spring Framework in general. It’s one of the popular spring questions and I have seen it many times.
In Spring MVC, both @Controller
and @RestContro…
Keep reading with a 7-day free trial
Subscribe to Javarevisited Newsletter to keep reading this post and get 7 days of free access to the full post archives.