Professional Documents
Culture Documents
inherit from @Component annotation as well. Although it is possible to create beans with only using
@Component annotation,
you will be missing some functionality which becomes available on your beans when they are defined with
appropriate stereo
type annotations.
For example, @Repository annotation helps handling of Hibernate or JPA specific exceptions and converting
them into Spring
@RequestMapping annotation. Although @Service annotation doesn’t make all of the public methods
transactional in a service
bean - like session beans in EJBs, it is just a matter of defining an annotation which brings those @Service
and @Transactional
@Controller
@Autowired
this.securityService = securityService;
//...
@Service
@Autowired
//...