The
@Repository
annotation (introduced in Spring 2.0) and @Service
annotation (introduced in Spring 2.5) are specialization of the @Component
annotation.
The main advantage of using
@Repository
or @Service
over @Component
is that it's easy to write an AOP pointcut that targets, for instance, all classes annotated with @Repository
.
Also, the specialized annotations help to clearly demarcate application layers (in a standard 3 tiers application).
No comments:
Post a Comment