aspose file tools *
The moose likes Spring and the fly likes What is Difference between @Service and @Component annotation in Spring Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "What is Difference between @Service and @Component annotation in Spring" Watch "What is Difference between @Service and @Component annotation in Spring" New topic
Author

What is Difference between @Service and @Component annotation in Spring

Sijesh Alayaril
Ranch Hand

Joined: Jan 13, 2012
Posts: 37


Hi All,

When developing a web application ,in service layer i found @service annotation but i'm not clear about the functionality of that annotation.Anyone could you please help me to understand this .


Thanks in Advance...


Cheers




Ken Rimple
author
Ranch Hand

Joined: Jul 20, 2010
Posts: 63

By default, nothing.

But, you can use @Service in AOP wirings, so that you can wrap all services with security, or transactions, etc...

So, it' really a stereotype, a classification.

In the future, maybe Spring will do something different with that, they reserve the right, but for now it's primarily so you can organize your own objects and identify them properly.

Ken

Ken Rimple
ken.rimple@gmail.com
Co-author, Manning Spring Roo in Action
I teach for Chariot Solutions (Spring, Maven, Hibernate, other courses). Schedule here
Sijesh Alayaril
Ranch Hand

Joined: Jan 13, 2012
Posts: 37
Thank You Ken..





Sijesh Alayaril
Ranch Hand

Joined: Jan 13, 2012
Posts: 37
Is @Autowired annotations is fulfill the concept of IOC or DI in Spring ?
Bill Gorder
Bartender

Joined: Mar 07, 2010
Posts: 1680
    
    7

Yes. Using the @Autowired or @Inject annotations is how your object defines its dependencies the container then injects those dependencies when it creates the bean.


[How To Ask Questions][Read before you PM me]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: What is Difference between @Service and @Component annotation in Spring