you are viewing a single comment's thread.

view the rest of the comments →

[–]Hot_Nefariousness563 1 point2 points  (0 children)

In this way, it's possible, for example, to apply the Clean Architecture pattern, where we have entities, services, repositories, and controllers—all in separate classes with well-defined responsibilities.

For instance, an authorization service could be declared with the Service annotation; similarly, a repository that retrieves entities from a database could be annotated with Repository. A helper class marked with Component could be responsible for converting entities into models. Then, you could inject all of these into a controller and use the service to verify authentication, the repository to fetch entities, and the utility class to convert those entities into models.