Thanks, no, can't do it based on dependency, because the starting of the
server (and the HornetQServer ref itself) is not actually a dependency. The
ClientSession seems to get created first, and without the server running it
fails. But I do have a work around. Thank you for the reply!
On Thursday, January 23, 2014 4:25:48 PM UTC-8, Christian Gruber wrote:
>
> Java 7 removed any deterministic order of method declarations from
> reflection apis (it was never guaranteed, it just happened to always
> work out in declaration order, nearly all the time). So unless we were
> to sort provides methods we cannot guarantee any order among them, and
> alphabetical may well not be what anyone wants.
>
> If you need order - dependency order is best. Can you not factor out a
> commonality to ensure that what needs to be created first is actually
> created first as a function of the dependency graph?
>
> Christian.
>
> On 23 Jan 2014, at 9:48, Alper Akture wrote:
>
> > In my app, I am binding an embedded HornetQServer instance. I do that
> > with
> > a @Provides in my module. I also bind a hornetq ClientSession object
> > with
> > an @Provides method in my module. The HornetQServer needs to be
> > initialized
> > before I can create a client session. Is there a way to control the
> > order
> > in which guice calls the @Provides methods? Is there other options,
> > i'm not
> > necessarily locked into the @Provides, but I also tried doing
> > explicitly
> > like this in the Module's configure method to no avail. Thanks for any
> > help.
> >
> > @Override
> > protected void configure() {
> > bind(HornetQServer.class).toProvider(new
> > Provider<HornetQServer>() {
> > @Override
> > public HornetQServer get() {
> > //create it here
> > }
> > });
> > bind(ClientSession.class).toProvider(new
> > Provider<ClientSession>() {
> > @Override
> > public ClientSession get() {
> > //return null;
> > }
> > });
> > //more binding calls follow
> >
> > --
> > You received this message because you are subscribed to the Google
> > Groups "google-guice" group.
> > To unsubscribe from this group and stop receiving emails from it, send
> > an email to [email protected] <javascript:>.
> > To post to this group, send email to
> > [email protected]<javascript:>.
>
> > Visit this group at http://groups.google.com/group/google-guice.
> > For more options, visit https://groups.google.com/groups/opt_out.
>
>
> Christian Gruber :: Google, Inc. :: Java Core Libraries :: Dependency
> Injection
> email: [email protected] <javascript:> :::: mobile: +1 (646) 807-9839
>
--
You received this message because you are subscribed to the Google Groups
"google-guice" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-guice.
For more options, visit https://groups.google.com/groups/opt_out.