There are 5 annotations you can use to create spring beans. List below answers.
Do you really need an interface? If you have one implementation for each service interface, just avoid it, use only the class. Of course, if you do not have RMI or when a proxy server is required.
@Repository - use to enter dao level classes.
@Service - use to enter service level classes. At the service level, you may also need the @Transactional annotation to manage your db transactions.
@Controller - Use interface level controllers for yours, such as JSF managed beans, injecting like spring beans.
@RestController - use spring for break controllers, this will help you avoid any time to put @ResponseBody and @RequestBody annotations in your rest methods.
@Component - use it in any other case when you need to enter a spring bean that is not a controller, service or tao class
Artur Yolchyan Nov 24 '16 at 6:42 2016-11-24 06:42
source share