Hi.
I am not sure how you can do this, but recently i put a provider inside my
MethodInteceptor doing this:

First of all I put a Provider in my MethodInterceptor class like this:
@Inject
Provider<DataSource> requestProvider;

And in the configureServlets method I put this:
JdbcTransactionInterceptor interceptor = new JdbcTransactionInterceptor();
bindInterceptor(Matchers.any(),
                        Matchers.annotatedWith(JdbcTransaction.class),
                        interceptor);
*requestInjection*(interceptor);

Look i emphasis the  requestInjection because it "puts" the provider in that
object.
In your case maybe you need to inject a static provider in your class
because you don't create a object in the configureServlets method.

I don't know how to create a static provider maybe in docs there are
something.

and in the con

2010/10/25 Josh Kamau <[email protected]>

> THanks for your response Guilherme,
>
> This is the problem. Normally the Domain or the persistent objects are not
> Guice managed objects. I would however want to inject services into them.
> How do i do that?
>
>
>
>
> On Mon, Oct 25, 2010 at 8:03 AM, Guilherme Namen <
> [email protected]> wrote:
>
>> Hi.
>> I am not sure if I understood your question, but you can create inject
>> objects annotated with parameters. See
>> http://code.google.com/p/google-guice/wiki/BindingAnnotations
>>
>> So you can for example do things like this:
>>
>> @EntityManager("EntityManger")
>> EntityManager em;
>> @EntityManager("EntityManger2")
>> EntityManager em2;
>>
>> 2010/10/25 Josh Kamau <[email protected]>
>>
>>> Hi Team;
>>>
>>> I am trying to do domain driven development. I would like my domain model
>>> objects to have all their behaviour methods. Previously i have been using
>>> dao's and managers to hold the behavior methods for the domain classes (i
>>> hope its clear). My question is, How do i inject services into my domain
>>> objects? is it a good idea? i would like to for example inject the entity
>>> manager to a domain class so that i can call save from the domain object its
>>> self.
>>>
>>> Kind regards.
>>> Josh
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "google-guice" group.
>>> To post to this group, send email to [email protected].
>>> To unsubscribe from this group, send email to
>>> [email protected]<google-guice%[email protected]>
>>> .
>>> For more options, visit this group at
>>> http://groups.google.com/group/google-guice?hl=en.
>>>
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "google-guice" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected]<google-guice%[email protected]>
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/google-guice?hl=en.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "google-guice" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<google-guice%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-guice?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"google-guice" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-guice?hl=en.

Reply via email to