Hi, Thanks for your suggestion. i will explore that as well and let you know how it goes.
regards. Josh On Mon, Oct 25, 2010 at 8:43 AM, Guilherme Namen <[email protected]>wrote: > Hi Josh. > I have a new idea. > Create a class that have all yours providers an put the getters and > setters. > Create a class that have a static singleton instance of this class. > Create the class with providers in configureServlets and > calls requestInjection > Put this class in the class that have the static instance. > And call in your code SingletonClass.getProvidersInstance.getProvider > > In this case you must have yours modules initializes before create a new > entity. > > > 2010/10/25 Guilherme Namen <[email protected]> > > Ok. If works please told me how. >> >> >> 2010/10/25 Josh Kamau <[email protected]> >> >>> Thanks. I will try out your idea. >>> >>> >>> On Mon, Oct 25, 2010 at 8:23 AM, Guilherme Namen < >>> [email protected]> wrote: >>> >>>> 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]<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.
