I think both @Component and @Service can be used to detect bean automatically, anyone can show me the difference between those two annotations?
I think both @Component and @Service can be used to detect bean automatically, anyone
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The basic difference between both annotations is that
@Serviceis a specialization of@Component.See also spring documentation for
@Service:A specialization of component is also a
@Repositoryand a@ControllerFurther information can be found e.g. here.