Another option is to call your initial method from constructor. If you
don't have access to source code, then as Noctarius mentioned you can use
provider.

-Dmitry

On Mon, Jan 9, 2012 at 9:15 PM, Noctarius <[email protected]>wrote:

> Am 10.01.2012 04:01, schrieb wahaha:
> > <bean id="dd" class="aa.bb.C" init-method="start" destroy-
> > method="dstr">
> >
> > in spring,we can define the initial method to run automatically after
> > the bean have been Instantiated.
> > how to do this in guice?
> > and i want guice to instantiate all beans that i defined in annotation
> > automatically,and then run the initial methon,not need me to use
> > Injector''s getInstance() method to get. how to do this?
> >
>
> Hey,
>
> you can use a Provider which instantiates your "bean" and call the
> init method before returning the instance.
>
> Noc
>
> --
> 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.
>
>

-- 
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