salve.googlecode.com -igor
On Tue, May 27, 2008 at 1:43 PM, francisco treacy <[EMAIL PROTECTED]> wrote: > hi, i'm refactoring a part of my standard > wicket/guice/warp-persist/hibernate app with DDD (domain-driven > design) principles. > > i use @Inject in my Pages, and this works fine, wicket-ioc proxied > injections are (only) available for Components. this is fine when i > inject for instance a Repository (~DAO). but what i now want is to be > able to use those Repositories from my domain entities. when using > @Inject in one of them, obviously no injection happens -- the field > remains null. > > after reading some threads i thought i could mimic @SpringBean's > behaviour outside Components, following suggested solutions such as: > - http://cwiki.apache.org/WICKET/springbean-outside-wicket.html > - InjectorHolder.getInjector().inject(this); > > with no success. i believe they're meant to work only with spring. > > someone in the mailing list proposed doing this in the constructor of > a domain entity: > ((GuiceInjectorHolder) ((MyWebApplication) > MyWebApplication.get()).getMetaData(GuiceInjectorHolder.INJECTOR_KEY)).getInjector().injectMembers(this); > > but i get a "org.apache.wicket.WicketRuntimeException: There is no > application attached to current thread main". > > am i missing something or there's no simple way to use injection in > entities other than passing the reference of the Repository proxy from > a wicket Component? it's ugly/unfeasible to pass in maybe 1 or 2 repos > to the entity's constructor. > what do you think? any other slightly better workaround? any other DDD > followers out there? i can help writing some patch if needed / please > point me in the right direction. > > thanks in advance, > francisco > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
