
Originally Posted by
cepage
We are in agreement here. Our primary point of disagreement is whether domain objects should ever be allowed to access application services, not just other domain collaborators.
This is over a year old, so let me know if your view has changed, but in
http://forum.springframework.org/showthread.php?t=9846 you state your position pretty clearly:
But it seems easier to me to just stick with what Spring makes easy... If you need a singleton collaborator... it's probably application logic. [and doesn't belong in a domain object]
I still have the same view. I am not a big fan of domain objects that have injected singletons to perform application logic. But it's not a big religious issue to me, just that of personal preference and what I've found works. As that thread you mentioned dealt with, Spring does make it possible to dependency inject collaborators into your domain objects. I did do this myself on one project, but shifted away from it in favour of the domain subproject.

Originally Posted by
cepage
Some simple examples. When an operation is performed on a domain object that will trigger a change in workflow state, I like for my domain object to directly message my OSWorkflow service to effect the change. When a delete operation needs to be performed on a single domain object, I like the domain object to be issued the delete operation, and allow him to in turn pass the message onto the DAO.
In that case I'd have my FooManager.delete(Foo) method handle the delete, which is also convenient because FooManager will be called within a broader transaction that might be performing other mutations.

Originally Posted by
cepage
I am not saying there is one right answer here. As you have mentioned, the approach you have taken has worked for you on successful projects. But right now, Spring only supports your approach, not mine.
I think you could use the DI into DOs if you wanted to. And as you are aware, this will continue to improve as AspectJ et al capabilities become richer.
I agree different approaches will suit different people and different projects. Awareness of the pros and cons of both makes people more capable developers and should be encouraged.