What is a spring service annotation? [duplicate]

@Service, @Controller, @Repository = {@Component + some more special functionality}

Click the below link for more details

What’s the difference between @Component, @Repository & @Service annotations in Spring?

The @Component annotation marks a java class as a bean so the component-scanning mechanism of spring can pick it up and pull it into the application context. The @Service annotation is also a specialization of the component annotation. It doesn’t currently provide any additional behavior over the @Component annotation, but it’s a good idea to use @Service over @Component in service-layer classes because it specifies intent better. Additionally, tool support and additional behavior might rely on it in the future.

Leave a Comment