How to handle injecting dependencies into rich domain models?

Posted by Arne on Stack Overflow See other posts from Stack Overflow or by Arne
Published on 2010-01-20T11:13:52Z Indexed on 2010/05/19 9:30 UTC
Read the original article Hit count: 212

In a web server project with a rich domain model (application logic is in the model, not in the services) how do you handle injecting the dependencies into the model objects? What are your experiences?

Do you use some form of AOP? Like Springs @Configurable annotation? Load time or build time weawing? Problems you encountered?

Do you use manual injection? Then how do you handle different instantiation scenarios (creating of the objects through an library [like Hibernate], creating objects with "new" ...)?

Or do you use some other way of injecting the dependencies?

© Stack Overflow or respective owner

Related posts about inversion-of-control

Related posts about domain-driven-design