Hi

(1) Perhaps you can extract the @Provides method to a class with an init() 
method, inject it in a listener and initialize it there.

Regards

[email protected] wrote:

>Hi,Iamcurrentlyworkingwithguiceanddropwizard.IamNOTusingthedropwizard-guicedependencysincethisissomewhatbrokenwiththelatestdropwizardversion.FortunatellyIfoundanicetutorialexplaininghowtogetthissetupsoIcanuseguice.
> 
>Ihoweverhaveafewissuesnow,wherecomingfromspring,Iamstrugglingtofindthealternative/bestpractiseforit.
> 
>Scenario1:Ihaveabeanthatsimplychecksatstartupthattheschemaofmydatabaseispresent.Isolvedthisbydoing:
> @Provides@Singletonpublicbla(){ 
>//object//init}Theissueis,thatInowhavetorunguiceinproduction.IamfeelingthatIamabusingtheeagersingleton
> 
>creationinproductionandnotdoingtherightthinghere.HowdoIcreatestandalonebeansthatgetcreatedanddosomework.InspringIwouldcreatethisandthencallaninitmethodonit.InguiceIamnotsurehowtosolvethis.Scenario2:TimerTasksthatarescheduledorsimplythreads.E.g.aMonitoringthreadthatgetsmetricinandpokesthemtoareportingserveronceaminute.Ihavethesameissuehere,icancreatethebean,butIcantcallrunonit.Also,ifIamnotinproduction,sincethebeanitselfisnotusedanywhere,itwontgetcreatedandwontdoanywork.Itdbegreatifsomeonecouldgivemesomepointerforthis:)
> 
>Thanks,Artur--YoureceivedthismessagebecauseyouaresubscribedtotheGoogleGroupsgoogle-guicegroup.Tounsubscribefromthisgroupandstopreceivingemailsfromit,sendanemailtogoogle-guice+unsubscr...@googlegroups.com.Toposttothisgroup,[email protected]http://groups.google.com/group/google-guice.Toviewthisdiscussiononthewebvisithttps://groups.google.com/d/msgid/google-guice/2cf2b64e-38fb-416d-a1ff-dd56618b9b99%40googlegroups.com.Formoreoptions,visithttps://groups.google.com/d/optout.

-- 
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/dx3xdw3ixygv864k3vg1ud7e.1442437165418%40email.android.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to