Java Spring Framework: Component, Repository, Service - differences
Explain the difference between:
ServiceTotal Java Spring Framework♪
Provide simple examples of use.
@Component- it's any random bin that Spring can find through.
Example: You did some class and you want to make a copy accessible through
The rest of the annotations identify layers of typical multi-layer architecture:
@Repository- That's it.
@Componentwith DAO-Slois semantics. The place where you go to the database. Spring's gonna make a drop-out class.
@Service- That's it.
@Componentwith a semantic layer of business logic.
@Controller- That's it.
@ComponentSemantic web complex. Such Spring bubbles will turn into earring.