On Sun, 15 Jun 2008, Per Newgro wrote:
> page. Because i had some business logic and i don't want it in my pages, i've 
> externalized it into an usecase class. Until now i've delivered the daos to 
> the usecase while calling the method (doMyStuff(myDao)). So far so good. 
> 
> My next step was to externalize the daos. They should be injected in my 
> usecase. But they wasn't. So i've read the threads an came up with
> 
> public MyUsecase() {
>   InjectorHolder.getInjector().inject(this);
> }

This is fine in normal UI layer pojo classes that you
construct with "new" operator in your own code during the
execution of the application.  But in Spring-managed beans
you should get your dependencies in with the normal Spring
mechanisms (@Resource, autowiring or in XML as what you
posted). Wicket should not be used in them.
 
By the way, I strongly recommend a domain-driven design,
with domain logic in the domain objects, instead of the
proceduralish / model2-actionish usecases.

Best wishes,
Timo

-- 
Timo Rantalaiho           
Reaktor Innovations Oy    <URL: http://www.ri.fi/ >

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to