Em Mon, 20 Apr 2009 19:05:24 -0300, manuel aldana <ald...@gmx.de> escreveu:

Your convention makes sense, but what do you do with objects which are usually created directly by other code and not by tapestry, thus constructor injection won't be the best solution?

If it's possible, I add the object as a Tapestry-IoC service. Create everything through a factory is a good practice, and T-IoC does that very nicely.

An example could be for instance domain-model objects, which use services internally. You create them by for instance passing mandatory fields into the constructor.

I don't get this example.

If applicable I try to inject services to domain-objects to add pluggable behaviour to them (so I don't end up with an anemic domain model).

I disagree with adding services to domain objects. But please let's not start a discussion about it. This is not the right place.

So I am right that tapestry-ioc exclusively is injecting fields after having passed the constructor code?

I don't know, but I guess the answer is yes, as it's impossbile in Java to invoke any method in an object before a constructor call on it.

--
Thiago H. de Paula Figueiredo
Independent Java consultant, developer, and instructor
http://www.arsmachina.com.br/thiago

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to