Hi,
I am currently working with guice and dropwizard. I am NOT using the
dropwizard-guice dependency since this is somewhat broken with the latest
dropwizard version. Fortunatelly I found a nice tutorial explaining how to
get this set up so I can use guice. I however have a few issues now, where
coming from spring, I am struggling to find the alternative/best practise
for it.
Scenario 1:
I have a bean that simply checks at startup that the schema of my database
is present. I solved this by doing:
@Provides @Singleton public bla() {
// object
// init
}
The issue is, that I now have to run guice in production. I am feeling that
I am abusing the eager singleton creation in production and not doing the
right thing here.
How do I create standalone beans that get created and do some work. In
spring I would create this and then call an init method on it. In guice I
am not sure how to solve this.
Scenario 2:
Timer Tasks that are scheduled or simply threads. E.g. a Monitoring thread
that gets metric in and pokes them to a reporting server once a minute. I
have the same issue here,
i can create the bean, but I can't call run on it. Also, if I am not in
production, since the bean itself is not used anywhere, it won't get
created and won't do any work.
It'd be great if someone could give me some pointer for this :)
Thanks,
Artur
--
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.
To view this discussion on the web visit
https://groups.google.com/d/msgid/google-guice/2cf2b64e-38fb-416d-a1ff-dd56618b9b99%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.