Member-only story
Difference between @Controller, @Service, and @Repository Annotations in Spring Framework?
While all three are stereotype annotation in Spring and can be use to represent bean where exactly they are used is the key for answering this popular Spring interview question
Hello friends, If you are preparing for Java and Spring Developer interview, it is important to understand the different annotations used in the Spring framework like what they do and when to use them. In the past, I have also told you about difference between @Contorller
and @RestController
annotation and in this article, we will take a look at another set of popular Spring annotations.
Three commonly used annotations are @Service
, @Controller
, and @Repository
. While these annotations may seem similar, they have different purposes and are used in different parts of the Spring application.
By the way, if you are preparing for interview In my earlier articles, I have also shared 25 Advanced Java questions, 21 Software Design Pattern questions, 20 SQL queries from Interviews, 50 Microservices questions, 60 Tree Data Structure Questions, 15 System Design Questions, and 35 Core Java Questions and 21 Lambda and Stream questions which you can use for your…