Anemic Domain Model in Typical Spring Projects (Part 2)

(Continued from Part 1)

Rich Domain Model Extreme could be an alternative, but in my opinion, you shouldn’t inject infrastructure classes to domain classes. Such code will quickly become unsupported and hell for testing, because every programmer has their own style of coding and in practice, this often violates conventions and good practices. Therefore, experience is tremendously important in this case. That is why we have to find some balance in anemic and rich models. In order to get a deeper knowledge of this topic, I would recommend reading this article.