You could abstract out the domain creation and then post inject using the injectInstance method (I think that is what it is called).
-bp On Oct 27, 2009, at 2:14 PM, Jo Vanthournout wrote: > > I was wondering whether guice has a way of injecting domain services > in domain objects. > > This is particularly handy when using domain driven design. This way, > domain objects themselves can be responsible for retrieving related > data and objects, which in turn results in better division of > responsibilities which results in a better OO design. All business > logic can be placed in the domain object (where it belongs) and the > need for rather artificial services that contain hidden business logic > is minimized. > > The problem here is that domain objects (entities and value objects as > they are called in domain driven design) are mostly constructed via > the new operator. Typically they are created by a framework like > hibernate, which pools the data for the domain object from the > database. > > Spring provides this functionality via load time weaving in > combination with the @configurable annotation. All the calls to the > new operator of the domain objects that are defined in the application > context are intercepted and the correct dependencies are injected. > > Thanks for the information > > Jo > Belgium > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "google-guice" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/google-guice?hl=en -~----------~----~----~----~------~----~------~--~---
