another option is to use salve (http://code.google.com/p/salve/).
instead of calling guice's injector as a service locator you use
@Dependency, that will lookup and inject your dependency (behind the
scenes it adds the class a proxy through bytecode instrumentation).
public class myLDM extends LoadableDetachableModel {
@Dependency myDAO;
public Object load() {
return myDAO.get(...);
}
francisco
On Fri, Feb 6, 2009 at 3:06 PM, Martin Grigorov <[email protected]> wrote:
> I have seen such code somewhere:
>
>
> public class myLDM extends LoadableDetachableModel {
>
> transient @SpringBean myDAO;
>
> public Object load() {
> InjectorHolder.getInjector().inject(this);
> return myDAO.get(...);
> }
>
> }
>
> El vie, 06-02-2009 a las 13:21 +0100, Martijn Dashorst escribió:
>> How would you inject the dao then?
>>
>> Martijn
>>
>>
>> On Fri, Feb 6, 2009 at 12:00 PM, Sergey Didenko
>> <[email protected]> wrote:
>> > Hi Andreas,
>> >
>> > Well, may be my question is silly, but:
>> >
>> > What about making "dao" a local variable in your component handlers?
>> > Then you can get rid of that serializing-deserializing of dao as a
>> > Component member.
>> >
>> > Does this approach have too much overhead? Does it make some things
>> > impossible?
>> >
>> > Cheers, Sergey.
>> >
>> > ---------------------------------------------------------------------
>> > 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]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]